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 @   枫树湾河桥  阅读(1432)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
Live2D
欢迎阅读『Mybatis Could not set parameters for mapping』
西雅图
14:14发布
西雅图
14:14发布
6°
多云
东北风
1级
空气质量
相对湿度
91%
今天
中雨
5°/9°
周三
3°/12°
周四
5°/10°
点击右上角即可分享
微信分享提示