how can i access Hibernate group by results. I try to get counts of the operation grouped by its date. My code is here:
Criteria crit = sess().createCriteria(Attendance.class);
crit.setProjection(Projections.projectionList()
.add(Projections.groupProperty("date"),"adate")
.add(Projections.rowCount(),"trueCount" ));
crit.add(Restrictions.eq("status", true));
List l = crit.list();
Right results is loaded to List. How can i access the results inside this list?
It should return a list of
Object[]whichObject[0]is for theadatealias (Date) andObject[1]is for thetrueCount(Integer) , so you can access the results in the returned list by: