getHibernateTemplate () 페이지 별 조회

721 단어 SSH자바
    :
final String hql = "from TransportOrders t where t.carriageUserId!=null order by t.orderId desc";
getHibernateTemplate().executeFind(
					new HibernateCallback() {
						public Object doInHibernate(Session session)
								throws HibernateException, SQLException {
							Query query = session.createQuery(hql);
							query.setFirstResult((page - 1) * pageSize);
							query.setMaxResults(pageSize);
							List list = query.list();
							return list;
						}
					});

     
Long num=(Long) getHibernateTemplate().find("select count(*) from TransportOrders t where t.carriageUserId!=null").listIterator().next();
   
count=num.intValue();

좋은 웹페이지 즐겨찾기