RE: PK in Expression ok?

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Wed Mar 23 2005 - 22:45:48 EST

  • Next message: tnaki..ofthome.net: "Re: PK in Expression ok?"

     
    > Is it possible to make a query that includes two criteria,
    > one of them being the primary key of the parent table. Can I
    > include the PK field like a regular field in one of the Expressions?
    >
    > I know I could retrieve the parent objec, get the array of
    > child objects and search that list for the object I'm looking
    > for but I'm thinking there must be an easier way.
    >
    > SelectQuery query = new SelectQuery(Budget_entry.class);
    >
    > query.setQualifier(Expression.fromString("description =
    > '"+this.getDescription()+"'"));
    > query.andQualifier(Expression.fromString("toBudget.budget_key=
    > '"+irf_key
    > +"'"));
    >

    Though I don't like to admit it, I have on a few occasions done something
    like this:

    ExpressionFactory.matchExp("toBudget", irf_key);

    No need to reference the pk field, though if you want to be explicit, you
    need to use a db: prefix or matchDbExp.

    Cris



    This archive was generated by hypermail 2.0.0 : Wed Mar 23 2005 - 22:45:45 EST