Reputation: 1682
My entity is defined like this:
public class Entity implements Serializeable {
@ManyToMany(mappedBy="entities")
private List<OtherEntity> otherEntities;
}
How can I select in HQL all Entities which have more than one OtherEntity?
Upvotes: 2
Views: 3013
Reputation: 21000
I think this should work. This will generate a SQL with a subquery - not fetch it and filter it in memory.
from Entity e where e.otherEntities.size > 1
Upvotes: 6