Reputation: 8640
Since version 2.1 JPA supports join on
. I found few examples how to use join on
in JPQL but none for Criteria API, and here is my question:
Is
JOIN ON
is implemented in Criteria APi? And if yes, Can anyone provide example?
Upvotes: 5
Views: 8495
Reputation: 11531
Try something like this
CriteriaQuery<Person> crit = cb.createQuery(Person.class);
Root<Person> candidateRoot = crit.from(Person.class);
Join<Person, Address> addrJoin = candidateRoot.join(Person_.address, JoinType.INNER);
addrJoin.on({some predicate});
filling "{some predicate}" with whatever ON clause you want to impose.
Upvotes: 6