在应用中获取session对象:
Session session= HibernateUtil.getSession();
List list=session.createCriteria(MeterUser.class).add(Restrictions.eq("name", "11")).addOrder(Order.desc("userid")).list();
Restrictions的用法: