JPA 2 — Using @ElementCollection in CriteriaQuery
问题 @Entity public class Person { @ElementCollection private List<Location> locations; [...] } @Embeddable public class Location { private Integer dummy; private Date creationDate; [...] } Given the following structure, I'd like to perform the HQL or CriteriaQuery equivalent of the following SQL: SELECT l.* FROM Location l INNER JOIN Person p ON (p.id = l.person_id) WHERE p.id = ? AND l.creationDate > ? I want to get back a list of Locations that are associated with the given person and whose