Re: Expression help with one-to-many relationship

From: Jeff de Vries (jdevrie..frog.com)
Date: Wed Nov 02 2005 - 19:56:47 EST

  • Next message: Andrus Adamchik: "Re: ObjEntity returning related entity's ObjAttribute"

    RTFM ... while re-reading the expression stuff, I saw that I can use the
    *Array stuff in the path expression, so I can do things like:
    Expression e = ExpressionFactory.matchExp("childArray.property",new
    Integer(5));
    (assuming my root object is parent).

    How can I get each parent only once, instead for each matching child?
    (I think this is UNIQUE in SQL?)

    Jeff de Vries

    Jeff de Vries wrote:
    > Assume I have the following tables:
    >
    > create table parent (
    > id int primary key,
    > ... stuff
    > )
    >
    > create table child (
    > parent_id int foreign key references parent(id),
    > ... stuff
    > )
    >
    > I need to find all the *parent* objects such that they have at least
    > one *child* object that meets some given set of conditions. I can
    > live with if a parent that has more than one child with the condition
    > gets listed multiple times, but ideally each parent would only show up
    > once.
    >
    > Sorry if this is some really basic SQL thing ...
    >
    > Jeff de Vries
    >



    This archive was generated by hypermail 2.0.0 : Wed Nov 02 2005 - 19:56:44 EST