日期:2014-05-17 浏览次数:20682 次
public List<UserLog> findUserLog(final int userId){ return this.getHibernateTemplate().executeFind(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { // TODO Auto-generated method stub Query q=session.createQuery("from UserLog where userId="+userId+" order by logId desc"); q.setMaxResults(10); q.setFirstResult(0); System.out.println("总条数:"+q.list().size()); return q.list(); } }); }