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


 

因為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]

總結:不適用 lambda查詢了,改用別的。 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM