hibernate distinct

想从DxfsCheckitem中查找出满足check_item不重复的记录

public List getDxfsCheckitemList() {


    Session session = null;

    String strSql= "from DxfsCheckitem y where (y.check_item,y.check_id)in(select x.check_item,max(x.check_id)from DxfsCheckitem x group by x.check_item)";
session = this.getHibernateTemplate().getSessionFactory().openSession();
        Query query = session.createQuery(strSql.toString());

// 获得记录集总数
        List list = query.list();
      
        return list;
           
}

from http://blog.csdn.net/zrchao/article/details/4419107

你可能感兴趣的:(Hibernate)