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

It should always be the same  irrespective of which page you are fetching:

query.setFirstResult(start_result);
query.setMaxRows( pageSize);
clientSession.executeQuery(query);
clientSession.logout();

so that will be:

query.setFirstResult(0);
query.setMaxRows( 25);
clientSession.executeQuery(query);
clientSession.logout();

in first iteration

and 
query.setFirstResult(25);
query.setMaxRows( 25);
clientSession.executeQuery(query);
clientSession.logout();

in second iteration

and:
query.setFirstResult(50);
query.setMaxRows( 25);
clientSession.executeQuery(query);
clientSession.logout();

in third iteration.

-------------------------------------------------------------------------------------------

On Mon, Jan 31, 2011 at 10:18 AM, Rohit Banga <rohit.banga@xxxxxxxxxx> 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 can use pagination across sessions?

    For Example:

    query1.setFirstResult(firstResult);
    query1.setMaxRows(maxRows);
    clientSession1.executeQuery(query1);
    clientSession1.logout();
    .
    .
    .
    query2.setFirstResult(firstResult + pageSize);
&n! bsp;   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

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



Back to the top