/*
* 分页显示收件箱的数量 */ public List getList(final User user, final int offset, final int rows) throws Exception { HibernateCallback callBack = new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Query query = session .createQuery("from Inbox s where s.touserid=:touserid order by s.status,s.createtime desc"); query.setFirstResult(offset); query.setMaxResults(rows); query.setLong("touserid", user.getId().longValue()); return query.list(); } }; return this.getHibernateTemplate().executeFind(callBack); } |
|
来自: moonboat > 《hibernate》