在用mybatis-plus更新数据的时候,更新失败,错误信息如下:

解决mybatis-plus更新数据的时候,有值为空导致更新失败的问题

Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='et.verificationCode', 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 #5 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111

细看错误信息可以看到是用于我要更新的值中有null值导致的,mybatis找不到对应的jdbcType。。。

解决办法

一种是给对应的字段显示的配置上jdbcType,当然这种比较麻烦,所以推荐全局配置

mybatis-plus.configuration.jdbc-type-for-null=varchar

参考文章

https://www.cnblogs.com/pangguoming/p/9041140.html

https://www.cnblogs.com/arebirth/archive/2019/08/30/11436432.html

相关文章:

  • 2021-11-22
  • 2021-09-16
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
猜你喜欢
  • 2023-02-08
  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
  • 2021-05-21
  • 2021-09-16
  • 2022-01-04
相关资源
相似解决方案