Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Eclipselink Pagination across sessions

You can use pagination with different sessions, but keep in mind that the
query result can change.  This is true even with the same session.  First of
all, you should always ensure that you use an order-by on the query to
ensure consistent results.  But even then, objects could be inserted,
updated or deleted.  Depending on your usage, this is normally not a big

If you change the query, then obviously the result will change, using
firstResult and maxResults will still work, but you will be getting a
different page from a different result.

Note that there is no logout() on ClientSession, only release().

Rohit Banga-2 wrote:
> Hi All 
> I was following the documentation available at
> . I wanted to confirm if we c an use pagination across sessions? 
> For Example: 
> query1.setFirstResult(firstResult); 
> query1.setMaxRows(maxRows); 
> clientSession1.executeQuery(query1); 
> clientSession1.logout(); 
> . 
> . 
> . 
> query2.setFirstResult(firstResult + pageSize); 
> query2.setMaxRows(maxRows + pageSize); 
> clientSession2.executeQuery(query2); 
> clientSession2.logout(); 
> Is the above correct? Does it work for all databases? 
> What if the selection criteria is different in query1 and query2? 
> Thanks 
> Rohit Banga 
> Member Technical Staff 
> Oracle Server Technologies

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

Back to the top