我有一个 JPA 查询来获取记录计数。但它显示 org.hibernate.hql.QueryExecutionRequestException。查询是
@NamedQuery(name = "StudyplanCategory.findCountByStatus", query = "SELECT count(s) FROM StudyplanCategory s WHERE s.status =:status")
请帮忙。
您需要选择计数(*)。请参阅文档 http://docs.jboss.org/hibernate/core/3.5/reference/en/html/queryhql.html#queryhql-tipstricks