mybatis-3.x的错误
1.Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
<mapper namespace="Order">区别于2.x为<sqlMap>,避免直接拷贝过来而不修改;
2.java.sql.SQLException: ORA-00904: "ID": 标识符无效
我出现的是sql问题,出错一定要打印参数及断点检测;
3.java.lang.NumberFormatException: For input string: "2015-03-20",找了半天找不到问题,最后发现是单引号不能有空格
<if test="userName!=null and userName!=''">
4.看下代码:
<!-- 用于填充一个combotree的下拉列表 -->
<select id="tree" resultType="ClassName">
select
id,
resName
from M_SYRESOURCES
where isuse=1
<if test="pId!=null and pId!=' '">
and pId=#{pId}
</if>
<if test="pId==null or pId==' '">
and pId is null
</if>
</select>
我开始做没问题,很顺利啊,但是突然有一天死循环了,我就特别晕啊,为什么了,我是核对了一般又一遍代码,和以前没出入啊,然后就开始苦逼的断点调试,终于发现原来pId=32被他解析成了(space),正好符合第二个条件啊,所以就死循环了,一定记得是'',没有空格德赛.
但是没有空格也是有错误的,因为0的ASCII码就是null啊,所以前后重复了,但是0就不管事了啊。可以看ASCII对应的数据,详情请点击。

浙公网安备 33010602011771号