Re: Paginated Queries

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Feb 10 2005 - 12:54:30 EST

  • Next message: Sami Mohammed: "Pagination query"

    Hi Sami,

    please direct your Cayenne questions to the user mailing list instead of
    sending to me directly [I am cc'ing it there]. Myself and our community
    will do our best to help.

    Andrus

    > Hi Andrus,
    >
    > Thanks once again for your help.
    > I have one proble that i have to do paginate in my
    > webapplication. i have 2000 rows and i have to show 20
    > rows on each page. could you send me the detail
    > example of paginate with classes and jsp pages.
    > i have your example below but that is not sufficant
    > for me
    >
    > your tutorial example below:
    > ---------------------
    > import java.util.List;
    > import java.util.Map;
    > import org.objectstyle.cayenne.access.DataContext;
    > import org.objectstyle.cayenne.query.SelectQuery;
    > import org.objectstyle.art.Artist;
    > ...
    > DataContext ctxt;
    >
    > // create a query returning data rows
    > SelectQuery q = new SelectQuery(Artist.class);
    > q.setPageSize(50);
    >
    > // the fact that result is paged is transparent
    > List artistRows = ctxt.performQuery(q);
    >
    >
    > // we are reading from the first page (index < 50),
    > // this will simply return an object
    > Artist artist1 = (Artist)artistRows.get(3);
    >
    > // we are reading from the 4th page,
    > // this will transparently resolve all objects on
    > "Page #4"
    > // and then return an object in question
    > Artist artist2 = (Artist)artistRows.get(153);
    >
    >
    > // This is safe and will NOT trigger a full fetch
    > int size = artistRows.size();
    > ...
    > --------------------
    > send me the jsp page where i can display 20 rows and
    > next and previous page.
    >
    > thanks
    > sami



    This archive was generated by hypermail 2.0.0 : Thu Feb 10 2005 - 12:54:32 EST