Re: Query.setFetchLimit

From: Tore Halset (halse..vv.ntnu.no)
Date: Thu Feb 23 2006 - 13:26:36 EST

  • Next message: Cris Daniluk: "Re: [proposal] - maven 2 based build?"

    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.

    > When I need to tweak things when query travels through the stack,
    > I'd usually use a decorator (e.g.
    > org.objectstyle.cayenne.query.QueryMetadataWrapper) that allows to
    > present modified metadata to Cayenne without altering the
    > underlying query.

    Perhaps this will solve my issue. Could be used by jpa Query.setHint
    as well.

    > In cases when you know the type of the query (such as inside the
    > Modeler that only supports SQLTemplate, SelectQuery,
    > ProcedureQuery) and where modification is appropriate, I just cast
    > to a concrete query type that has all needed setters.

    This is my current (not comitted) approach. Should work ok until
    someone creates a new query type :)

      - Tore.



    This archive was generated by hypermail 2.0.0 : Thu Feb 23 2006 - 13:26:38 EST