I got my model
public class Comic implements Serializable {
@Id
@Basic(optional = false)
@Column(name = "id")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
@ManyToMany
private Set<User> owners;
(lots of blah blah blah)
}
and I want to query for total numer of owners of any comic I have, other speaking simply for a number of rows in joining table. But I have no idea how to refernce this table? How should this query in JPA2.0 would look like?
Something like this: