//使用hibernate分页 pageSize 每页显示数, startRow 为 从第几个记录开始读取
public List findAllLuser(int pageSize, int startRow) throws HibernateException {
final int pageSize1 = pageSize;
final int startRow1 = startRow;
//System.out.println(pageSize1 & startRow1);
return this.getHibernateTemplate().executeFind(new HibernateCallback() {
public List doInHibernate(Session session) throws HibernateException, SQLException {
// TODO 自动生成方法存根
Query query = session.createQuery("from luser order by id");
query.setFirstResult(startRow1);
query.setMaxResults(pageSize1);
//System.out.println(query.list().size());
return query.list();
}
});
}
返回为 List 对象