baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.41k stars 4.31k forks source link

3.5.1 oracle数据库,使用LambdaUpdateWrapper更新数据时,报无效列类型,如何解决 #6175

Closed 1012827105 closed 5 months ago

1012827105 commented 5 months ago

mapper.update(null,new LambdaUpdateWrapper().set(PO::getUpdateUser,null))

org.apache.ibatis.type.BaseTypeHandler#setParameter 调用ps.setNull(i, jdbcType.TYPE_CODE);方法报错,报错详情如下: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='ew.paramNameValuePairs.MPGENVAL1', 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 null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111

zhaoyunxing92 commented 1 month ago

PO::getUpdateUser这个类上面是不是有typeHandler

zhaoyunxing92 commented 1 month ago

PO::getUpdateUser这个类上面是不是有typeHandler

HK-hub commented 3 weeks ago

oracle遇到同样的错误,是不是要把字段设置为空

HK-hub commented 3 weeks ago

同款错误

int update = this.baseMapper.update(null, wrapper
                                .set(PileSendOutPlan::getSendType, pileSendOutPlan.getSendType())
                                .set(PileSendOutPlan::getSendNow, pileSendOutPlan.getSendNow())
                                .set(PileSendOutPlan::getNextDaySend, null)
                                .set(PileSendOutPlan::getPlanSendTime, pileSendOutPlan.getPlanSendTime())
                                .eq(PileSendOutPlan::getId, pileSendOutPlan.getId()));