我想知道如何在休眠状态下制作群组。 我的代码在下面,但它不起作用请告诉我这是怎么做的:
Session session = getSession();
Criteria c = session.createCriteria(CardLog.class);
c.add(Restrictions.ge(CARD_PUNCHING_TIME, todaysDate));
c.setProjection(Projections.groupProperty(USER_ID));
c.addOrder(Order.desc(USER_ID));
cardLogList = c.list();
System.out.println("----------------" + cardLogList);
答案 0 :(得分:0)
我认为你必须像这样使用
Session session = getSession();
Criteria c = session.createCriteria(CardLog.class);
c.add(Restrictions.ge("bean property todaydate", todaysDate));
c.setProjection(Projections.groupProperty("bean property userId"));
c.addOrder(Order.desc("bean property userId"));
cardLogList = c.list();
System.out.println("----------------" + cardLogList);