这是我的代码,
Criteria criteria = session.createCriteria(Category.class);
criteria.add(Restrictions.eq("id", 102));
criteria.setProjection(Projections.projectionList().add(Projections.property("item")).add((Projections.alias(Projections.count("item.itemId"), "itemsCount"))));
criteria.addOrder(Order.desc("itemsCount"));
List<items> items = criteria.list();
非常感谢!
答案 0 :(得分:0)