My entity is defined like this:
public c开发者_JS百科lass Entity implements Serializeable {
@ManyToMany(mappedBy="entities")
private List<OtherEntity> otherEntities;
}
How can I select in HQL all Entities which have more than one OtherEntity?
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
精彩评论