首页 > 其他分享 >mybatis报错:can not find lambda cache for this property

mybatis报错:can not find lambda cache for this property

时间:2022-12-16 14:01:06浏览次数:40  
标签:cache 报错 mybatis link com find lambda

因为MP3.2+之后不会缓存实体类的父类字段信息,所以在使用泛型的Lambda表达式时会报错.

{@code MybatisPlusException: can not find lambda cache for this entity [com.copm.ifm.base.basic.pojo.BaseTreePO]} 

原因是在执行{@link com.baomidou.mybatisplus.core.toolkit.LambdaUtils#getColumnMap(Class)}时

他会将所有扫描到的mapper中的泛型({@link BaseMapper<Class>}中的Class,即实体类)的字段信息缓存到

{@link com.baomidou.mybatisplus.core.toolkit.LambdaUtils}中的{@code COLUMN_CACHE_MAP}中。

但是MP3.2+之后不会加载父类的信息,所以{@code COLUMN_CACHE_MAP}中没有相关缓存,就报错了。

因此我们单独为{@link BaseTreePO}添加一个的Mapper类,这样他就会缓存该类的信息了。

错误信息如下:

com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this property [aricOrderNo] of entity [com.pcitc.si.fss.ssf.ass.entity.SsfAssRule]

解决:

TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""), FlowDone.class) ;

标签:cache,报错,mybatis,link,com,find,lambda
From: https://www.cnblogs.com/jianwei-dai/p/16987167.html

相关文章