All the users that join should be in the 'subscribers' collection, regardless of the information field being null or not.
The mapping look like
Code:
@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
@JoinTable(
name = "lists_subscribers",
joinColumns = {@JoinColumn(name = "listid")},
inverseJoinColumns = {@JoinColumn(name = "userid")})
private Set<User> subscribers;
but when Hibernates queries the database and counts the number of rows, it select the last column and counts the non NULL entries. The last column happens to be a nullable one, thus yielding an incorrect count.
Thanks for your help! PL