分页,oracle ,hibernate

记录每个开发细节,虽然很简单。
hibernate实现关键代码
                        int items = (pageIndex-1) * 10;//pageIndex第几页
			hql = "from MissionArchive";
			query = session.createQuery(hql);
			query.setFirstResult(items);
			query.setMaxResults(10);//每页10条
			list = query.list();

oracle_sql 实现代码(0-10条)
select * from(select rownum as r,t.* from mission_archive t )
 where r<=10 and r>0

你可能感兴趣的:(java,sql,HQL,Hibernate)