我需要使用休眠将我的类的属性映射到计数查询。我有这样的课:
public class Surveys{
private int completedSurveys;
public int getCompletedSurveys{
return completedSurveys;
}
public void setCompletedSurveys(int completedSurveys){
this.completedSurveys = completedSurveys;
}
}
我需要在 SQL 中进行这样的计数:
SELECT COUNT(*) FROM surveys WHERE status = 'completed'
并放入属性completeSurveys。
谢谢