【发布时间】:2021-05-23 07:39:11
【问题描述】:
我有 2 个与 @ManyToMany 关系相关的实体:
public class EntityA {
@Id
private Long id;
.
.
.
@ManyToMany(fetch = fetchType.EAGER)
private List<EntityB> listOfB;
}
我想创建 JPA 规范,该规范将通过 EntityB 的 id 查询 IN 子句。 我试过了
private static Specification<EntityA> listOfB(String path, List<Long> idsOfB) {
return (root, query, cb) -> {
//path is passed as "listOfB"
return root.get(path).in(idsOfB);
};
}
但我得到 org.postgresql.util.PSQLException: ERROR: syntax error at or near "."
【问题讨论】:
标签: spring-boot hibernate jpa many-to-many