关于 Mybatis 的Invalid bound statement (not found):错误
2016-07-13 22:56
399 查看
今天遇到一个特别奇怪的问题,最后发现是自己对mybatis的学习还有待提高
返回类型可以用resultType,也可以用resultMap
resultType是直接表示返回类型的,而resultMap则是对外部ResultMap的引用
举个例子:
resultMap:
<select id="findByContract" resultMap="BaseResultMap">
select
*
from
user
where
tel=#{tel}
</select>
resultType:
<select id="getCountGroupbyUserSex" resultType="com.iswust.controller.vo.stat.StatUserSexBean">
select sex as
type,count(*) as count from user group by sex;
</select>
<select id="findConnectByid" resultType="java.lang.String">
select
tel
from
user
id=#{user_id}
</select>
以后再也不要犯这么愚蠢的错误啦
返回类型可以用resultType,也可以用resultMap
resultType是直接表示返回类型的,而resultMap则是对外部ResultMap的引用
举个例子:
resultMap:
<select id="findByContract" resultMap="BaseResultMap">
select
*
from
user
where
tel=#{tel}
</select>
resultType:
<select id="getCountGroupbyUserSex" resultType="com.iswust.controller.vo.stat.StatUserSexBean">
select sex as
type,count(*) as count from user group by sex;
</select>
<select id="findConnectByid" resultType="java.lang.String">
select
tel
from
user
id=#{user_id}
</select>
以后再也不要犯这么愚蠢的错误啦
相关文章推荐
- 两台机器之间移动数据库的最简单
- SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size
- (1)ActivityThread分析
- 标题
- 录音
- java学习总结(16.07.13)java的系统相关类(System类和Runtime类)
- Python 面向对象高级编程――使用__slots__
- NwCreate之创建nwc文件
- ThinkPHP基础(一)搭建环境
- MySQL监控模板说明-Percona MySQL Monitoring Template for Cacti
- MS14-058(CVE-2014-4113)利用代码
- Intellij IDEA 提交代码到远程GitHub仓库
- Maven 版 JPA 最佳实践(转)
- Python语言及其应用 第2章
- Python 面向对象编程――获取对象信息
- DataTable 分页
- Qt中文路径问题(Cannot find file: 进程"C:\Qt\4.8.5\bin\qmake.exe"退出,退出代码 2)
- IO多路复用-Select
- android AutoCompleteTextView 实现输入提示
- 微软自带后门