Could not set parameters for mapping
错误现象:
Resolved [org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='keywords', 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 #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).]
SQL如下:
Mapper 如下
List
错误原因:
给#{keywords}多加了单引号导致。删掉单引号,错误解决。
本文来自博客园,作者:瘦腿先生Stephen,转载请注明原文链接:https://www.cnblogs.com/Stephen-leg/p/18139324