Re: Query.setFetchLimit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Feb 23 2006 - 10:40:13 EST

  • Next message: Andrus Adamchik: "Re: ant default target ..."

    Tore,

    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.

    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.

    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.

    If neither of this works for you, could you describe a scenario -
    we'll come up with something.

    On Feb 23, 2006, at 8:13 AM, Tore Halset wrote:
    > Hello!
    >
    > Having a general
    > org.objectstyle.cayenne.query.Query
    >
    > How can I check if it accept changing the fetchLimit property? And
    > changing other properties?
    >
    > Have tried query.getMetaData(ctxt.getEntityResolver()), but it
    > returns the immutable QueryMetadata. Something like a public
    > WritableQueryMetadata interface would be nice :)
    >
    > - Tore.
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Feb 23 2006 - 10:40:14 EST