Re: Query using foreign objects

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Feb 07 2006 - 12:09:36 EST

  • Next message: Andrus Adamchik: "Re: Primary keys in expressions"

    I guess I still don't understand what you are trying to do and
    offering solutions to non-existent problems :-)

     From this example and without seeing your DataMap, I second what
    Cris said in his message in the parallel thread - you should use
    relationship names as expression paths and related DataObjects as
    parameters. Directly matching on PK/FK while possible, is rarely needed.

    Andrus

    On Feb 7, 2006, at 11:54 AM, Dave Merrin wrote:

    > Hi Andrus,
    >
    > How does your function help me create an expression using several
    > primary
    > keys?
    >
    > Expression exp1 = ExpressionFactory.matchExp
    > (ItemType.ITEM_TYPE_ID_PK, 1);
    > Expression exp2 =
    > ExpressionFactory.matchExp(ItemProperty.ITEM_PROPERTY_ID_PK, 2);
    > Expression exp = exp1.andExp(exp2);
    >
    > SelectQuery query = new SelectQuery(Item.class, exp);
    > List<Item> list = dataContext.performQuery(query);
    >
    > The above won't work unless I map an ObjEntity to the DbEntity for the
    > primary key.
    >
    > Dave
    >



    This archive was generated by hypermail 2.0.0 : Tue Feb 07 2006 - 12:09:38 EST