日期:2014-05-18 浏览次数:20662 次
public List<E> loadListEntities(final PageUtil page) {
return this.getHibernateTemplate().executeFind(new HibernateCallback<List<E>>() {
public List<E> doInHibernate(Session session) throws HibernateException, SQLException {
Long totalL = (Long) session.createQuery("select count(*) from "+page.getModelName()).uniqueResult();
page.setTotalCount(totalL.intValue());
return session.createQuery("from " +page.getModelName()).setFirstResult((page.getPageNow()-1)*page.getPageSize()).setMaxResults(page.getPageSize()).list();
}
});
}