Re: Query.setFetchLimit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Feb 25 2006 - 00:09:53 EST

  • Next message: Bill Dudney: "Fwd: maven bits..."

    On Feb 23, 2006, at 9:26 PM, Tore Halset wrote:

    > On Feb 23, 2006, at 16:40, Andrus Adamchik wrote:
    >
    >> Cayenne has an implicit contract to not modify the queries when
    >> they are passed along the stack. Among other things this
    >> simplifies "indirect" queries implementation, such as QueryChain.
    >> So generic Query and QueryMetadata interfaces intentionally don't
    >> provide setters.
    >
    > I am working on named queris for the jpa-stuff. I get the query
    > from the DataMap and want to manipulate the query with things like
    > setFetchLimit etc.

    EntityManager is a single user session, while DataMap and its queries
    are shared by all sessions. So we must return an instance of
    javax.persistence.Query built in such way that its modifications are
    not viewable inside other EntityManagers.

    So I guess a wrapper-based approach makes sense regardless of the
    underlying query type (so a user will manipulate the properties of
    the wrapper), and as far as I can tell casting to concrete Cayenne
    queries may only be needed to bind parameters (and you can cast to
    ParameterizedQuery). Hints can be stored inside
    javax.persistence.Query and then returned in a metadata wrapper.

    Andrus



    This archive was generated by hypermail 2.0.0 : Sat Feb 25 2006 - 00:09:55 EST