Re: How to dynamically get Qualifier info from SelectQuery object

From: Mike Kienenberger (mkienen..mail.com)
Date: Thu Sep 01 2005 - 11:05:59 EDT

  • Next message: Mike Kienenberger: "Re: Yet another optimistic locking question"

    That's because Expression isn't a string and a list of arguments.

    It's a hierarchical struture. You're actually working with three Expressions.

    AndExpression contains the userid Expression and the name Expression

    On 9/1/05, Pirola Davide <davide.pirol..tin.it> wrote:
    > 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 - 11:06:32 EDT