---
title: "数据库分页"
author: "luogen33"
date: "2011-09-06T23:25:42Z"
tags: []
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2011-09-06T23:25:42Z"
id: 1167147
url: "https://luogen33.iteye.com/blog/1167147"
---

1. 数据库分页： 
  mysql: 
       select * from A limit startRow,endRow 
   oracle: 
        select b.* from (select a.*,rownum as linenum from (select * from A)        a where rownum<= endRow) b where linenum >= startRow 
   
Hibernate分页 
Query q = session.createQuery("from Cat as c");;   
q.setFirstResult(20000);;   
q.setMaxResults(100);;   
List l = q.list();;