This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
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