当前使用版本(必填,否则不予处理)
1.mybatis-plus:3.5.3.1 2.Springboot:2.7.13 3.数据库:pgsql
该问题是如何引起的?(确定最新版也有问题再提!!!)
1.更新数据时,json引起异常
2.数据库字段
2.1
3 Java属性
3.1 autoResultMap = true 已开启
3.2
4. LambdaUpdateWrapper写法
4.1 set(StringUtils.isNotBlank(dto.getDicTransl()),SysPageDetail::getDictTransl,dto.getDicTransl())
5.接收到的值
重现步骤(如果有就写完整)
更新必现
报错信息
nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='ew.paramNameValuePairs.MPGENVAL11', 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 non null for parameter #11 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #11 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.util.ArrayList. Use setObject() with an explicit Types value to specify the type to use.
Comment From: miemieYaho
用set(R column, Object val, String mapping)方法,mapping传typehandler=xxx.XxTypeHandler
Comment From: cat0i
有案例吗,小白不会用
Comment From: cat0i
我在网上找了一个自定义的TypeHandler
引用的案例:https://blog.csdn.net/nahancy/article/details/111879547
然后这里面的Mapping不知道传什么,粗略的看了一下文档自己没有找到
Comment From: qmdx
使用 typeHandler 解决,官方参考文档 https://baomidou.com/pages/fd41d8/