问题集

作者: 薛云龙 | 来源:发表于2016-03-21 11:09 被阅读25次

1.在,一个对象的mapper中:

<mapper namespace="Pluto.Dao.inter.PlutoOperation"> 
自定义一个resultmap
<resultMap type="Music" id="resultListMusic">       
<result column="id" property="id" />   
<result column="title" property="title" />  
</resultMap>
调用上面的resultmap   
<select id="SeachMusicByDESC"  resultMap="resultListMusic"> 
select * from music order by id DESC  
</select>
</mapper>
这里返回的是一个list对象,在mybatis中,没有resultset这个对象

2.在需要传入多个参数的时候,select组中就不需要明确指出参数的类型了,需要在下文中sql语句,通过index来表明传入的变量

<select id="JudgeadminNameAndPwd" resultType="ResultSet"> 
select * from admin where adminName = #{0} and adminPwd = #{1}
</select>

3。发现一个惊天 bug,对于3.0.4版本的mybatis.jar,会有可能出现这种错误:
[mybatis IllegalArgumentException:
Mapped Statements collection does not contain value]
这个问题整整刁难了我一个下午,本来以为是xml文件路径不对,mapper映射错误,方法名与xml文件中的id不对应,结果都不是。
问题出在jar包身上,在stackoverflow搜了好长时间,发现这一句,然后换了jar包之后,问题迎刃而解

This error sometime appears on the first query with MyBatis 3.0.4. This is fixed in 3.0.5-SNAPHOT.
来源:http://mybatis-user.963551.n3.nabble.com/Mapped-Statements-collection-does-not-contain-value-td2553948.html

相关文章

  • 问题集

    .....

  • 问题集

    tomcat在eclipse中启动成功,主页却打不开https://blog.csdn.net/did_itmyw...

  • 问题集

    1. dataframe.mode(“overwrite”)的使用 2. 3. scala case when 4...

  • 问题集

    为什么残差平方和SSE的自由度是n-2?why is the degree of freedom of SSE(S...

  • 问题集

    1.在,一个对象的mapper中: 2.在需要传入多个参数的时候,select组中就不需要明确指出参数的类型了,需...

  • 问题集

    1、使用pip安装scrapy 报 OSError:Operation no permite 可能是新mac系统S...

  • 问题集

    css 模块化在 tsx 文件引入不正确 搭建好的 React 项目。https://www.jianshu.co...

  • 问题集

    Question1: Add an Activity to Mobile 创建项目失败 一次升级版本后,创建mod...

  • 问题集

    饥饿感来自于胃吗? 天行健可以控制饥饿感吗? 大脑密码的慧觉自我观察能控制饥饿感吗? 怎样才能最快速的学会慧觉脑力...

  • Linux基础

    Linux问题集

网友评论

      本文标题:问题集

      本文链接:https://www.haomeiwen.com/subject/foeklttx.html