Re: Cayenne 3.0M3 : select query with LIMIT and OFFSET clauses

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Mar 16 2008 - 18:16:05 EDT

  • Next message: Gary Jarrel: "Cayenne in j2ee - message beans"

    Then another way to achieve this is a paginated query. You'd perform a
    query with 'setPageSize(...)' that retrieves ids of all objects. Then
    you cache the resulting list and reuse between requests.

    As a side note, 3.0M3 optimizes paginated queries substantially and
    yet unreleased 3.0M4 optimizes it even more, allowing it to scale to
    at least a few hundred thousands of rows:

    https://issues.apache.org/cayenne/browse/CAY-999

    If you have even more rows, or memory is a premium, then you'd have to
    use SQLTemplate.

    Andrus

    On Mar 16, 2008, at 11:57 PM, Jean-François Smigielski wrote:

    > Of course I can. :)
    >
    > In a short term, I have to provide a web application with some JSP,
    > where I
    > simply have to present a list of persistent and manageable objects.
    > The
    > table might be big, and I would present sublists (each with a bounded
    > cardinlity), with http links to jump to the prev/next sublist. The
    > OFFSET
    > and LIMIT parameters are then known from the URL (after some sanity
    > checks).
    >
    > Further, some Web-services will have to do the same kind of table
    > listings,
    > with attributes known from the request parameters.
    >
    > If it helps, I am pretty sure this application will use either MySQL,
    > Postgresql or Apache-Derby as a DB backend.
    >
    > Thanks again.
    >
    > JFS
    >
    > 2008/3/16, Andrus Adamchik <andru..bjectstyle.org>:
    >>
    >> Specifying offset is not (yet) supported. Aside from SQLTemplate
    >> there
    >> are various ways to solve it depending on your requirements. So can
    >> you explain how do you know which OFFSET to use, maybe there is an
    >> alternative solution...
    >>
    >>
    >> Andrus
    >>
    >>
    >>
    >> On Mar 16, 2008, at 10:10 PM, Jean-François Smigielski wrote:
    >>> Hello, list!
    >>>
    >>> I am wondering if and how it is possible to limit the result of a
    >>> SelectQuery with Cayenne 3.0.
    >>>
    >>> For a user interface purpose, I want to be able to present only a
    >>> subset of
    >>> a select on a huge table. I already use the setFetchLimit(int)
    >>> method to set
    >>> a LIMIT clause, but I am unable to precisely tell the OFFSET at
    >>> which my
    >>> subset must start. I do not find how in the online Javadoc.
    >>>
    >>> Any help would be appreciated, thanks a lot!
    >>> Best regards,
    >>>
    >>> --
    >>> JF Smigielski
    >>
    >>
    >
    >
    > --
    > JF Smigielski



    This archive was generated by hypermail 2.0.0 : Sun Mar 16 2008 - 18:16:37 EDT