我是靠谱客的博主 可耐毛巾,这篇文章主要介绍mybatis Error setting non null for parameter #2 with JdbcType null . 分页错误,现在分享给大家,希望可以做个参考。

今天项目开发时候,出现这个错误;
在使用pageHelp进行分页查询时,除了这个错误:
意思是我们传入了两个参数,但是SQL语句只有一个参数(2 > number of parameters, ) 导入错误;
查看我们的SQL语句:

复制代码
1
2
3
4
<if test="orderBy == 3"> order by cpr.`status` asc - - 价格降序 </if>

解决方法:
pageHelp分页就是往SQL语句最后添加limit ?
我们这里使用行尾注释 导致limit ?被注释了,少了一个参数出错
去掉行尾注释就好了

com.kunchi.kshop.channel.spi.kmng.home.KmngProductSearchSpi:调用过程发生未知异常:nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘Second_PageHelper’, mode=IN, javaType=class java.lang.Integer, jdbcType=null, numericScale=null, resultMapId=‘null’, jdbcTypeName=‘null’, expression=‘null’}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 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 (2 > number of parameters, which is 1).

最后

以上就是可耐毛巾最近收集整理的关于mybatis Error setting non null for parameter #2 with JdbcType null . 分页错误的全部内容,更多相关mybatis内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(68)

评论列表共有 0 条评论

立即
投稿
返回
顶部