这段代码给了我两个项目日期时间和计数的列表。但我需要按日期分组,没有时间。
谁能给我一个线索怎么做?谢谢!
Criteria criteria = getSession().createCriteria(Parcel.class);
ProjectionList projectionList = Projections.projectionList();
projectionList.add(Projections.groupProperty("dateCreated"));
projectionList.add(Projections.rowCount());
criteria.setProjection(projectionList);
List<Object[]> results = criteria.list();
结果:
2013-04-27 11:08:00.0 | 32
2013-04-27 11:10:00.0 | 5
2013-04-28 15:03:27.0 | 12
我需要:
2013-04-27 | 37
2013-04-28 | 12