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

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 

--- James Sutherland Oracle TopLink ,
 EclipseLink , TopLink
Wiki: Java Persistence , EclipseLink 
Forums: TopLink , EclipseLink , Glassfish
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top