Mybatis Plus报错: can not find lambda cache...

发布时间 2023-08-29 17:48:48作者: r1se

使用mybatisplus 时使用Lambda 表达式做查询条件会遇到mybatis拿不到缓存问题:

错误1:com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this entity
错误2:can not find lambda cache for this property [XXX] of entity [com.XXX.XXX]

解决方法:

在LambdaQueryWrapper条件之前添加以下语句

TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), “”), 条件类名.class)