Re: [eclipselink-users] Pagination and Results
setFirstResult / MaxResults is the proper way to do pagination through JPA.
There are some other ways, but it is normally the most efficient.
Other methods include using a ScrollableCursor (EclipseLink API only), or
performing the pagination yourself using an order by and range comparison.
The result set is not cached when using setFirstResult / MaxResults, each
seperate query is a seperate database query. The resulting objects will be
Vespa, Anthony J wrote:
> I'm about to start exploring some pagination in my code for going
> through results, and I'm curious about tips and/or best practices for
> paging through results? I've seen some forum posts referring to using
> setFirstResult / MaxResults - is this the proper way?
> I will mainly be accessing data via named queries on entity objects, and
> the data sets could be quite large, so I am looking for the most
> efficicent way to page through results in different chunks (by 20, by 50
> Also, lets say that I have a query that returns all the results for a
> given statement (eg 100). So user1 runs that and begins to page thru -
> and then user2 comes along to my web app and runs the same query but now
> there are 110 results - is the first result set object cached on a per
> user basis? I assume that in both queries the first 100 objects are
> cached but what about result sets and the number of results? Will this
> cause any issue with paging?
> Thanks for the help,
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.oracle.com/technology/products/ias/toplink/ Oracle TopLink ,
EclipseLink , https://glassfish.dev.java.net/javaee5/persistence/ TopLink
Wiki: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence ,
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink ,
View this message in context: http://www.nabble.com/Pagination-and-Results-tp14253916p14254627.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.