Re: relationship between inherited entities

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Apr 15 2004 - 14:23:18 EDT

  • Next message: Andrus Adamchik: "Re: DataContext x EJB"

    Hi Sabiha,

    > if I want to have relationship (to-many) between “Manager” and
    > “Developer”, how to implement it?

    Actually I haven't tested such case yet, but I don't see why it
    wouldn't work... To map such relationship, create a corresponding
    self-referencing pair of DbRelationships in Employee *DbEntity*, for
    instance called "employees" and "toManager". Then create a new
    ObjRelationship in Manager ObjEntity (but not in Employee ObjEntity)
    that maps to "employees" DbRelationship.

    Let us know how this worked.

    > Did I miss something here or did something wrong?

    You also need to do some "magic" with your data objects per chapter
    8.6.1 buried deep in the user guide:
    http://objectstyle.org/cayenne/userguide/dataobjects/dataobjects-
    inheritance.html . This step is probably just a temporary thing.
    Hopefully in the next releases we will move this information it to the
    mapping.

    Cheers
    Andrus

    On Apr 15, 2004, at 9:06 AM, sabiha wrote:
    > Hi,
    > I’m exploring inheritance in Cayenne and have simple model with
    > ObjEntities: “Employee”, “Manager” and “Developer”. (Manager and
    > Developer are inherited from Employee).
    >
    > To implement inheritance I created only DbEntity “Employee” (not
    > corresponding DbEntities for inherited ObjEntities) that contains all
    > attributes of those classes (ObjEntities). And I have done all needed
    > configuration described in Modeler guide: for ObjEntity “Employee” I
    > set “Table/View” to be corresponding DbEntity – “Employee” and for
    > inherited entities I set “Inheritance” to be “Employee” ObjEntity.
    >  And for inherited entities I set corresponding qualifiers: “manager”
    > and “developer”.
    >
    > Did I miss something here or did something wrong?
    >
    > What my question is: if I want to have relationship (to-many) between
    > “Manager” and “Developer”, how to implement it?
    >
    > Thanks in advance!
    >
    > Sabiha



    This archive was generated by hypermail 2.0.0 : Thu Apr 15 2004 - 14:23:27 EDT