栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

mapper.xml出现错误 Error setting non null for parameter #3 with JdbcType null .

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

mapper.xml出现错误 Error setting non null for parameter #3 with JdbcType null .

记录学习SSM框架遇到的问题3

异常报告

消息 Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘id’, mode=IN, javaType=class java.lang.Integer, jdbcType=null, numericScale=null, resultMapId=‘null’, jdbcTypeName=‘null’, expression=‘null’}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #3 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 (3 > number of parameters, which is 2).

描述 服务器遇到一个意外的情况,阻止它完成请求。

出现问题的原因主要是出现在mapper.xml文件中,可能会有几个原因:
1、两个#写在了一起,会出现识别错误 (我的错误)


        update news
        
            
        
        where id=##{id}
    

2、里面出现javaEE的注释


        update news
         
            
        
        where id=#{id}
    

3、#{id}被单引号盖住了(摘自网上被人的错误 )


        update news
        
            
        
        where id='#{id}'
    

以上各种细节错误可能都会导致SQL语句执行时出现错误,所以以后开发过程程中还是尽量细心一点。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/318355.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号