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

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

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

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

eclipselink-users mailing list

Back to the top