MyBatis通用mapper插入,更新null值问题

时间:2025-03-21 09:30:08

MyBatis通用mapper插入,更新null值问题

  • Mybatis通用Mapper updateByPrimarykey()和insert()方法报错,提示jdbctype错误。
Exception in thread “main” : Error setting null for parameter #6 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: : 无效的列类型: 1111 

  • springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置, 默认是Other)
  @Bean
    public ConfigurationCustomizer configurationCustomizer(){
        return new MybatisPlusCustomizers();
    }

    class MybatisPlusCustomizers implements ConfigurationCustomizer {

        @Override
        public void customize( configuration) {
            ();
        }
    }