我正在使用JPA Criteria API。鉴于此TypedQuery:
CriteriaBuilder cb = JPA.em().getCriteriaBuilder();
CriteriaQuery<Foo> cq = cb.createQuery(Foo.class);
Root<Foo> composite = cq.from(Foo.class);
SetJoin<Foo, Foo> relative = composite.join(Foo_.related);
Path<Long> relativeIdPath = relative.get(Foo_.id);
Predicate predicate = relativeIdPath.in(someIds);
cq.where(predicate);
TypedQuery<Foo> tq = JPA.em().createQuery(cq);
relativeIdPath
是否知道指向IN子句的连接表的右侧?怎么样?
答案 0 :(得分:0)
因为您从relativeIdPath
获得了relative.get(Foo_.id)
,顺便提一句就是加入(SetJoin
)本身。