如果你使用的是xml文件配置mapper,并且传入了null值,则也会引发这个错误:

Exception in thread "main" org.mybatis.spring.MyBatisSystemException: nested
exception is org.apache.ibatis.type.TypeException: Could not set parameters for
mapping: ParameterMapping{property='dictionaryFilename', mode=IN,
javaType=class java.lang.String, jdbcType=null, numericScale=null,
resultMapId='null', jdbcTypeName='null', expression='null'}. Cause:
org.apache.ibatis.type.TypeException: Error setting non null for parameter #1
with JdbcType null . Try setting a different JdbcType for this parameter or a
different configuration property. Cause: java.sql.SQLException: 无效的列索引

解决方法:根据网上资料说,是加上jdbcType,如
#{dictionaryFilename,jdbcType = VARCHAR}
但是注解形式不是这个问题,因为#起的是一个占位符作用,而在java中字符串中$才能起到占位符作用,所以我们要将#变为$。



变为



这样解决了。

另外如果你要传入多个参数的时候,要么使用map传入,要么加上@Param注解

参考博客:https://blog.csdn.net/csdn_am/article/details/79854107
<https://blog.csdn.net/csdn_am/article/details/79854107>

友情链接
ioDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信