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

1 - Yes if you use a join fetch and 1-m with pagination that is an issue to
be aware of.  As of EclipseLink 2.1 this is handled by not using the join
fetched data for the first and last rows in the page, as the data may not be
complete.  As an alternative to join fetch you could also use a batch fetch
using IN.

2 - setMaxResults() is the JPA Query API, in the EclipseLink native API it
is setMaxRows()

3 - The public interface for ClientSession is the Session interface, it
defines a public release() API.
(logout is not defined on Session, so not usable in a ClientSession)

Rohit Banga-2 wrote:
> 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?
> 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().

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