MyBatis通用mapper插入,更新null值问题
- Mybatis通用Mapper updateByPrimarykey()和insert()方法报错,提示jdbctype错误。
代码语言:javascript
复制Exception in thread “main” org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #6 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111
- springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other)
代码语言:javascript
复制 @Bean
public ConfigurationCustomizer configurationCustomizer(){
return new MybatisPlusCustomizers();
}
class MybatisPlusCustomizers implements ConfigurationCustomizer {
@Override
public void customize(org.apache.ibatis.session.Configuration configuration) {
configuration.setJdbcTypeForNull(JdbcType.NULL);
}
}