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 17:19:58 浏览: 21
这个错误提示是由 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: java.lang.ClassNotFoundException: com.baomidou.mybatisplus.annotation.SqlParser
Caused by: java.lang.ClassNotFoundException: com.baomidou.mybatisplus.annotation.SqlParser 是一个Java异常,表示在运行时找不到指定的类 com.baomidou.mybatisplus.annotation.SqlParser。
这个异常通常发生在以下情况下:
1. 缺少相关的依赖库或jar包。如果在项目中使用了 com.baomidou.mybatisplus.annotation.SqlParser 类,但是没有将对应的依赖库添加到项目中,就会导致找不到该类的异常。
2. 类路径配置错误。如果类路径配置不正确,也会导致找不到指定的类。
解决这个异常的方法有以下几种:
1. 确保相关的依赖库或jar包已经正确添加到项目中,并且版本匹配。
2. 检查类路径配置是否正确,确保能够正确加载到指定的类。