一个Hql中count判断的写法
:::java
public static void test() {
String hql = "select o.teacher.id, o.teacher.goodStudentCount from Student o"
+ " group by teacher having count(*)>o.teacher.goodStudentCount";
List<Long[]> idCounts = Teacher.find(hql).fetch();
for (Long[] idCount:idCounts) {
Logger.debug("id: %s, %s", idCount[0], idCount[1]);
Long id = idCount[0];
}
renderText("ok!" + idCounts.size());
}