我正在尝试按学生
的数量对学校
进行排序。它们之间存在 ManyToOne
/OneToMany
关系。
这不起作用,但这是我到目前为止所拥有的
来自学校的按人数排序(s.students)
我不想使用 Criteria,因为我必须重构大量代码。有没有办法用HQL
来实现这一点?
最佳答案
好吧,我明白了。这有效
学校按人数排序(s.students)
根据 Hibernate 文档
You can test the size of a collection with the special property size or the special size() function.
关于java - 按计数 HQL 排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30676512/