Criteria criteria = session.createCriteria(Items.class);
criteria.add(Restrictions.eq("itemId", 1003));
criteria.addOrder(Order.desc("category.categoryName"));
此类别是ManyToOne Mapping。 谢谢!
答案 0 :(得分:0)
Criteria criteria = session.createCriteria(Items.class)
.add(Restrictions.eq("itemId", 1003))
.createAlias("category", "category")
.addOrder(Order.desc("category.categoryName"));