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

Thank you James

1. In case I am joining two tables, then a single entity can be spread across multiple rows of the table. For example I am joining an employee table with a phone table and an employee has a one to many relation with the phone table. I am using some page size to fetch the employees. Let us say I use order by on the employee id.

If an employee is spread across two pages, then each page will contain partial information about that employee. Is there a standard way of handling this?

Should I do something like

select * from (select * from employee where condition_added_using_first_result_and_max_rows), phone where some_other_condition;

or is there a better solution?

I can assume that if the data is altered between two successive page requests, I will not get the correct results.

2. There is no setMaxResults m
http://www.eclipse.org/eclipselink/api/2.1/

3. The method release() is marked as INTERNAL. Can I still use it or is there a substitute?

Thanks
Rohit Banga
Member Technical Staff 
Oracle India Private Limited 
91 80 41085685 

----- Original Message -----
From: jamesssss@xxxxxxxxx
To: eclipselink-users@xxxxxxxxxxx
Sent: Wednesday, February 2, 2011 9:36:55 PM GMT +05:30 Chennai, Kolkata, Mumbai, New Delhi
Subject: 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.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top