一次性报的异常主要有以下几个:
java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException:
Could not set parameters for mapping: ParameterMapping{time=’time’, mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId=’null’, jdbcTypeName=’null’, expression=’null’}.
Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #4 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property.
Cause: java.sql.SQLException: Parameter index out of range (4 > number of parameters, which is 3).
最后发现原来是。。。
mapper.xml映射文件里有注释!!!!!
把注释删掉,一切OK!
————————————————
版权声明:本文为优快云博主「sayWhat_sayHello」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/sayWhat_sayHello/article/details/82716056
本文解决了在使用MyBatis框架时遇到的参数设置异常问题,异常源于mapper.xml映射文件中的注释导致的参数数量不匹配。通过删除多余注释,成功解决了参数设置异常,恢复正常的数据交互。
448

被折叠的 条评论
为什么被折叠?



