Caused by: org.flowable.common.engine.impl.javax.el.ELException: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this property [userId] of entity [com.ehl.base.workflow.handler.SysUserRole]
时间: 2024-03-03 13:19:57 浏览: 23
这个错误可能是因为在使用 MyBatis-Plus 进行数据库访问时,出现了无法找到实体类对应的 lambda 缓存。这可能是因为实体类中的属性名与数据库表中的列名不一致,或者是实体类中的属性没有使用 MyBatis-Plus 的注解进行标注。你可以检查一下实体类的属性名和注解是否正确,或者尝试手动清除 MyBatis-Plus 的缓存来解决这个问题。
相关问题
Caused by: org.flowable.common.engine.impl.javax.el.ELException: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this property [userId] of entity [com.ehl.base.system.domain.SysUserRole]
这个错误提示是由 Flowable 引擎的 EL 表达式引擎抛出的,表示在执行 EL 表达式时,调用了一个 Mybatis-Plus 框架中的方法,但是该方法在执行时出现了异常,具体是找不到实体类 `SysUserRole` 中的属性 `userId` 对应的 Lambda 表达式缓存。可能的原因有:
1. `SysUserRole` 实体类中没有定义 `userId` 属性,或者该属性没有使用 Mybatis-Plus 提供的注解进行标注。
2. `SysUserRole` 实体类中的 `userId` 属性使用了 Mybatis-Plus 提供的注解进行标注,但是编译时没有生成对应的 Lambda 表达式缓存。这种情况可能是由于编译环境或者 Mybatis-Plus 版本不兼容造成的。
3. 在使用 EL 表达式时,传入的实体类对象中没有 `userId` 属性,或者该属性的值为 null。
你可以根据具体的场景,检查以上可能的原因,并进行相应的调整。
我用了这种List<Long> userIds = new LambdaQueryChainWrapper<>(sysUserRoleMapper) .select(SysUserRole::getUserId) .in(SysUserRole::getRoleId, groups) .list() .stream() .map(SysUserRole::getUserId) .collect(Collectors.toList());写法报错Caused by: org.flowable.common.engine.impl.javax.el.ELException: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this property [userId] of entity [com.ehl.base.workflow.handler.SysUserRole]
这个错误信息显示是找不到 `SysUserRole` 实体类的 lambda cache,可能是因为 `SysUserRole` 类没有使用 `@TableName` 注解,或者没有在 MyBatis Plus 的配置文件中开启自动注入。
你可以尝试在 `SysUserRole` 类上添加 `@TableName` 注解,指定对应的表名,例如:
```
@TableName("sys_user_role")
public class SysUserRole {
// ...
}
```
然后在 MyBatis Plus 的配置文件中开启自动注入,例如:
```
@Configuration
@MapperScan("com.example.mapper")
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
@Bean
public ConfigurationCustomizer configurationCustomizer() {
return configuration -> configuration.setUseDeprecatedExecutor(false);
}
}
```
如果还有问题,请提供详细的错误信息和相关代码,我会尽力帮助你解决。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)