Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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
cached.


Vespa, Anthony J wrote:
> 
> Hello,
> 
> 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
> etc)
> 
> 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,
> 
> Tony 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.oracle.com/technology/products/ias/toplink/ Oracle TopLink , 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  https://glassfish.dev.java.net/javaee5/persistence/ TopLink
Essentials 
Wiki:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence , 
http://wiki.eclipse.org/EclipseLink EclipseLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink , 
http://www.nabble.com/java.net---glassfish-persistence-f13455.html Glassfish
Persistence 
-- 
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.



Back to the top