Re: SelectQuery help

From: Bryan Lewis (brya..aine.rr.com)
Date: Fri Jan 14 2005 - 08:08:16 EST

  • Next message: Jürgen Saar: "Re: SelectQuery help"

    The easy way is to define a flattened relationship from Role back to Person.

    http://objectstyle.org/cayenne/modelerguide/modeling-object-layer/flattenedrel.html

    Then your code can simply refer to role.getPersons().

    ----- Original Message -----
    From: "Jin Lee" <jinsle..mail.com>
    To: <cayenne-use..bjectstyle.org>
    Sent: Friday, January 14, 2005 3:09 AM
    Subject: SelectQuery help

    > Hey all,
    >
    > I have these three tables:
    >
    > Person (personid, name)
    > PersonRole (roleid, personid)
    > Role (roleid, rolename)
    >
    > Where Person has 1-many PersonRole and PersonRole has 1-1 Role
    >
    > I used the modeler to establish the relationships. What is the proper
    > SelectQuery for selecting Persons with rolename equal to a certain
    > role (such as "employee")
    >
    > Any help is greatly appreciated.
    >
    > Thanks,
    >
    > Jin



    This archive was generated by hypermail 2.0.0 : Fri Jan 14 2005 - 08:08:24 EST