I store in database data as | RAPORT_DAY | FIELD_VALUE | USER_ID. All works good if I specify user_id, I'm getting one record for one day. But if I dont specify user_id I'm getting a lot of records for same day. Is it possible to sum field_value for each day by criteria ?
if (userId != null) {
criteria.add(Restrictions.eq("user.id", userId));
}
criteria.add(Restrictions.ge("raportDay", dateFrom));
criteria.add(Restrictions.le("raportDay", dateTo));
criteria.setProjection(Projections.projectionList()
.add(Projections.property("raportDay"))
.add(Projections.property(field)));