wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes To Retrieve multiple rows separately Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "To Retrieve multiple rows separately" Watch "To Retrieve multiple rows separately" New topic

To Retrieve multiple rows separately

nami shekar

Joined: Sep 14, 2011
Posts: 17
How can I retrieve only the first n rows, second n rows of a database (using a particular WHERE clause ? )
For example, if a SELECT typically returns a 1000 rows,
how do first retrieve the 100 rows, then go back and retrieve the next 100 rows and so on ?

Suggestions or comments are welcome
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
If you are using JPA, you can use the firstResult and maxResults properties on the Query.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
nami shekar

Joined: Sep 14, 2011
Posts: 17
Thanks James,
You are right. I could use firstResult and maxResults to get it done.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: To Retrieve multiple rows separately
Similar Threads
Passing table as parameter to next page(JSTL)
How do you map a table to a collection of Entity Beans
How to get Data in Batches
How i can create multiple pages dinamic with a servlet ?
How to get specified no. of rows from jtable