Mybatis Could not set parameters for mapping

原文链接:https://www.jianshu.com/p/0a00d17ad9bb

bug全名:Could not set parameters for mapping:

        ParameterMapping{property='content', mode=IN, javaType=class java.lang.String, jdbcType=VARCHAR,

        numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause:

        org.apache.ibatis.type.TypeException: Error setting non null for parameter #9 with JdbcType VARCHAR . Try

        setting a different JdbcType for this parameter or a different configuration property. Cause:

        java.sql.SQLException: Parameter index out of range (9 > number of parameters, which is 8).

 

原因:1.在mybatis xml映射文件中,不能用ctrl /来标记注释,该方式标记注释会是 #code的形式,在mybatis中会报上述错误,如需注释,应该用

<!--code-->的形式。

            2.在mybatis注解或xml中,字符串内不能使用#{}标记占位而要用${}

posted @ 2022-07-19 13:30  枫树湾河桥  阅读(1335)  评论(0编辑  收藏  举报
Live2D