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]
时间: 2024-03-03 16:19:58 浏览: 160
这个错误提示是由 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);
}
}
```
如果还有问题,请提供详细的错误信息和相关代码,我会尽力帮助你解决。
Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, please exclude the tableName or statementId.
这个错误是由 Mybatis Plus 引起的。根据错误信息,可能是在查询数据库时出现了问题。具体的原因是由于 Mybatis Plus 引发了一个异常:MybatisPlusException。这个异常可能是由于没有正确处理 tableName 或 statementId 导致的。你可以检查一下代码中的相关部分,确保正确设置了 tableName 或 statementId。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.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)