Hibernate criteria

获取记录总数:
totalResult = (Integer)criteria.setProjection(Projections.rowCount()).uniqueResult();


获取记录
criteria.setProjection(null)
         .setResultTransformer(Criteria.ROOT_ENTITY);
list = criteria.list();

你可能感兴趣的:(Hibernate)