public PagerModel getPage(Object[] params, int firstResult, int maxResult) {
StringBuilder buf = new StringBuilder();
buf.append("from Person p , Student stu where p.stuID=stu.stuid order by p.stuId desc");
List list = this.getHibernateTemplate().find(buf.toString());
List<Person > personList = new ArrayList<Person>();
for(int i=firstResult ;(i<list.size() && i<(firstResult+maxResult));i++){
Object[] obj = (Object[])list.get(i);
Person pinfo= (Person )obj[0];
personList .add( pinfo );
}
PagerModel pm = new PagerModel();
pm.setDatas( personList );
pm.setTotal(list.size());
return pm;
}
Hibernate 多表关联,返回分页模型
最新推荐文章于 2024-10-29 11:56:11 发布