RE: How to dynamically get Qualifier info from SelectQuery object

From: Pirola Davide (davide.pirol..tin.it)
Date: Thu Sep 01 2005 - 10:56:18 EDT

  • Next message: Gili: "Re: Yet another optimistic locking question"

    Hi,
    i have noticed that if i want to access to a single qualifier:

    <![CDATA[(USER_ID = $userId)]]>

    the operand count is 2... the first is "USER_ID" and the second is "$userId".

    If i use a multiple qualifier:

    <![CDATA[((UserId = $userId) and (Name = $name))]]>

    the operand count is always 2... but now the first is "UserId = $userId" and the second is "Name = $name".

    Why this different behavior?
    There isn't a standard method to retrive a field name?

    thank's
    Davide

    -----Original Message-----
    From: Mike Kienenberger [mailto:mkienen..mail.com]
    Sent: giovedì 1 settembre 2005 16.42
    To: cayenne-use..bjectstyle.org
    Subject: Re: How to dynamically get Qualifier info from SelectQuery
    object

    Expression e = qry.getQualifier() will give you the qualifier
    expression that is built from <![CDATA[(USER_ID = $userId)]]>.

    On 9/1/05, Pirola Davide <davide.pirol..tin.it> wrote:
    > Hi,
    > i want to extract at runtime the quelifier data from a SelectQuery object.
    >
    > I have a query defined in a datamap xml file:
    > ---------------------------------------------------
    > <query name="qryStat" factory="org.objectstyle.cayenne.map.SelectQueryBuilder" root="obj-entity" root-name="stat">
    > <qualifier>
    > <![CDATA[(USER_ID = $userId)]]>
    > </qualifier>
    > </query>
    > ---------------------------------------------------
    >
    > I have obtained a SelectQuery:
    >
    > ---------------------------------------------------
    > SelectQuery qry = (SelectQuery) resolver.getQuery("qryStat");
    > ---------------------------------------------------
    >
    > How i can retrive the field name used in "where" expression? (USER_ID)
    > Is possible to get it form a property defined in SelectQuery ?
    >
    > Thank's
    > Davide
    >



    This archive was generated by hypermail 2.0.0 : Thu Sep 01 2005 - 10:54:50 EDT