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
Author

To Retrieve multiple rows separately

nami shekar
Greenhorn

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
Greenhorn

Joined: Sep 14, 2011
Posts: 17
Thanks James,
You are right. I could use firstResult and maxResults to get it done.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To Retrieve multiple rows separately