MyBatis在操作Oracle数据库时,插入Null提示无效字符:1111

这是因为mybatis在解释null默认转换为数据Other类型,MySQL认识,但是Oracle不认识,所以报错。

Caused by: org.apache.ibatis.type.TypeException: Error setting null for parameter #3 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111

两种解决方法

  1. 在插入语句中的字段的表达式括号内加入jdbc类型


2.在Mybatis全局配置文件中加入setting : jdbcTypeForNull

    
        
    

问题即可解决

你可能感兴趣的:(MyBatis在操作Oracle数据库时,插入Null提示无效字符:1111)