让我有以下crtieria查询:
int offset;
int count;
Date from;
Date to;
//Initialization of offset, count, from, to variables
ProjectionList projections = Projections.projectionList().
add(Projections.groupProperty("date"));
addSumProjections(projections);
criteria.setProjection(projections);
criteria.setFirstResult(offset);
criteria.setMaxResults(count);
criteria.add(Restrictions.ge("date", from));
criteria.add(Restrictions.le("date", to));
private void addSumProjections(ProjectionList projections) {
projections.add(Projections.sum("clickCount"))
.add(Projections.sum("funPlayers"))
.add(Projections.sum("funRounds"))
}
我想按照funRounds
属性的总和对结果表进行排序,通过添加相应的投影add(Projections.sum("funPlayers"))
来计算。是否可以使用条件查询来做到这一点?