开发者

How can I select objects by list size in HQL?

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜