Consider the following:
@Entity
public class Book
{
private List<String> authors;
@ElementCollection
public List<String> getAuthors() {
return authors;
}
public void setAuthors(List<String> authors) {
this.authors = authors;
}
}
How to type a JPA2 CriteriaQuery expression which, say, will let me find all the Books which have more than 2 authors?
In JPQL:
Using the criteria API (but why would you replace such a simple static query with the following mess?):