Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: Invalid column type: 1111

Mybatis-plus 连接Oracle数据库,更新插入操作报错,为空的字段不知道类型导致报错!!!

 

 

方法一

在字段上添加注解
el = " 字段名, jdbcType=字段类型 "
比如本例

@TableField(strategy= FieldStrategy.IGNORED,el = "remarks, jdbcType=VARCHAR")
protected String remarks;

方法二

修改配置文件 application.yml

mybatis-plus:
configuration:
jdbc-type-for-null: 'null' #注意:单引号

 

 两个方法各有利弊,修改配置文件时针对所有的空字段都进行空处理,如果有些字段空值默认值需要传入0或者其他时,
可以采用字段注解方式

posted @ 2022-08-24 16:36  Mr_li_one  阅读(4629)  评论(0编辑  收藏  举报