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
issue.

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
> http://wiki.eclipse.org/Using_Advanced_Query_API_(ELUG)#Handling_Query_Results_Using_Pagination
> . 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
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/Eclipselink-Pagination-across-sessions-tp30809189p30827323.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top