Mybatis错误:Error setting non null for parameter #4 with JdbcType null

在使用Mybatis向Oracle数据库插入数据的时候,遇到一个错误,如下所示:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='deviceId', 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 #4 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 #4 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: 无效的列索引

        反复检查SQL语句,以及Mybatis的各项配置,发现都没有什么错误,最终发现:竟然是因为sql语句中存在注释的原因;如下:

        删除注释,重新执行语句,一切正常,数据完美插入到数据库!

        这个问题耽误一天时间,无语!

猜你喜欢

转载自blog.csdn.net/sssxlxwbwz/article/details/125358606
今日推荐