Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for th

项目场景:

springboot、mybatis-plus


问题描述:

模糊查询"like"语句异常

 常规写法:

Caused by: 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: 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).
    at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:75)
    at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.setParameters(MybatisDefaultParameterHandler.java:228)
    ... 108 more 

 修改之后写法:

原因分析:

原因我也不知道

解决方案:

经过伟大的互联网搜索,感谢@以后的今天大神文章的讲解,使用数据库的函数concat(),成功解决!

前辈解决方案传送门


版权声明:本文为NotBitter原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。