hibernate条件查询

1.
Criteria criteria = getSession().createCriteria(User.class);
        criteria.createAlias("areaitem","b"); //关联对象areaitem,b别名
        criteria.add(Restrictions.sqlRestriction("to_char(SCRQ, 'yyyy-mm-dd')=?", "2002-02-15", Hibernate.STRING));
        criteria.addOrder(org.hibernate.criterion.Order.asc("b.areaName"));
        criteria.addOrder(org.hibernate.criterion.Order.asc("b.itmeName"));

你可能感兴趣的:(Hibernate,Criteria)