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

When using Mybatis to insert data into the Oracle database, I encountered an error, as shown below:

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: 无效的列索引

        After repeatedly checking the SQL statement and the various configurations of Mybatis, I found that there were no errors. Finally, I found that it was because of the existence of comments in the sql statement ; as follows:

        Delete the comment and re-execute the statement. Everything is normal and the data is perfectly inserted into the database!

        This question has delayed me for a whole day, I’m speechless!

 

Guess you like

Origin blog.csdn.net/sssxlxwbwz/article/details/125358606