您的当前位置:首页正文

使用mybatisplus时 Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping

来源:华佗健康网

开发背景:原生框架为mybatis+springcloud,自主升级为mybatisplus后调用save方法时出现问题

报错:

 Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property 'params'. It was either not specified and/or could not be found for the javaType (java.util.Map) : jdbcType (null) combination.

解决及原因:

实体类继承了BaseEntity  在BaseEntity当中有params字段 

而Map集合是插入不到数据库当中的,即使它为空并且数据库字段当中也没有,依然会报错,解决办法要么是写一个TypeHandle对它进行全局转换(没必要,毕竟不存入到数据库),要么加一个注解(可以解决)

@TableField(exist = false)

因篇幅问题不能全部显示,请点此查看更多更全内容