Caused by: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_0.attrName', 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 #5 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 (5 > number of parameters, which is 4).
at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.setParameters(MybatisDefaultParameterHandler.java:233) ~[mybatis-plus-core-3.3.1.jar:3.3.1]
at com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor.queryTotal(PaginationInterceptor.java:257) ~[mybatis-plus-extension-3.3.1.jar:3.3.1]
... 145 common frames omitted
Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 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 (5 > number of parameters, which is 4).
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:71) ~[mybatis-3.5.3.jar:3.5.3]
at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.setParameters(MybatisDefaultParameterHandler.java:231) ~[mybatis-plus-core-3.3.1.jar:3.3.1]
... 146 common frames omitted
Caused by: java.sql.SQLException: Parameter index out of range (5 > number of parameters, which is 4).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965) ~[mysql-connector-java-5.1.47.jar:5.1.47]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898) ~[mysql-connector-java-5.1.47.jar:5.1.47]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887) ~[mysql-connector-java-5.1.47.jar:5.1.47]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861) ~[mysql-connector-java-5.1.47.jar:5.1.47]
at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3367) ~[mysql-connector-java-5.1.47.jar:5.1.47]
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3352) ~[mysql-connector-java-5.1.47.jar:5.1.47]
at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:4068) ~[mysql-connector-java-5.1.47.jar:5.1.47]
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setString(HikariProxyPreparedStatement.java) ~[HikariCP-3.4.5.jar:na]
at org.apache.ibatis.type.StringTypeHandler.setNonNullParameter(StringTypeHandler.java:31) ~[mybatis-3.5.3.jar:3.5.3]
at org.apache.ibatis.type.StringTypeHandler.setNonNullParameter(StringTypeHandler.java:26) ~[mybatis-3.5.3.jar:3.5.3]
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:69) ~[mybatis-3.5.3.jar:3.5.3]
... 147 common frames omitted
这个是错误的sql.xml, 注释出错
<select id="findById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM client_info
where client_id= #{clientId}
/*where client_id= #{clientId}*/
</select>
sql里的注释 /* xxxxxx */ 没有删除,于是尝试去掉已注释的代码,结果真的就这样解决了。
可是用<!-- -->
这种格式注释的代码块不会导致这样的错误.
内网开发报这个错, 都快被搞疯了。
参考:https://blog.****.net/streetlight8023/article/details/69388495