Re: Many To Many relations: how to?

From: Jonathan Carlson (Jonathan.Carlso..atun.com)
Date: Thu Jul 01 2004 - 09:57:16 EDT

  • Next message: Andriy Shapochka: "Re: Ashwood Library"

    Claudio asks a good question.

    The documentation talks about how to create a flattened relationship (where the associative table has no corresponding object) but it seems to assume that the Cayenne model was generated from an existing database schema. I'm hoping the documentation can be improved to describe how to model a flattened many-to-many relationship from scratch. (Or maybe I just missed something obvious)

    :-)

    Thanks,

    Jonathan Carlson

    >>> "Claudio Rosati" <claudio.rosat..csys.it> 2004-07-01 8:02:44 AM >>>
    Hello all,
     
    I have two classes, Record and Collocation, that should have a many-to-many
    relation, like the one in the picture.
     
    Class diagram
     
    Each class is backed by a corresponding DbEntity (records and collections).
    These entities contains just one attribute: a primary key VARCHAR[64] one
    called uid, reflected into the corresponding class as the uid String
    attribute.
     
    What I would like is the situation depicted, where when I add a Collocation
    to a Record using the addToCollocations method, the corresponding list of
    Records in the Collocation object is updated automatically.
     
    Being ignorant about DBs and their management (this is why I'm using
    Cayenne), I don't understand if it is possible and how to realize it with
    Cayenne (and its modeler): I need to add some attributes to the DbEntities
    (which one?), I need to add helper tables (whicwh one?), Which kind of
    relation I need to set up...?
     
    Thanks in advance for any help.
     
    Claudio
     
     

             Multimedia <http://www.acsys.it/> Division
            

    Claudio Rosati
    Project Manager Advanced Computer Systems S.p.A.
    via Della Bufalotta 378
    00139 Roma, RM
    Italy
    claudio.rosat..csys.it
    tel:
    fax: +39 06 8709 0516
    +39 06 8720 1502
            

     <http://www.plaxo.com/signature> Signature powered by Plaxo
    <http://www.plaxo.com/signature> Want a signature like this?
     <https://www.plaxo.com/add_me?u=4295038861&v0=140354&k0=586510396> Add me
    to your address book...
     

    *********************************************************************************
    This email and any files transmitted with it are confidential and
    intended solely for the use of the individual or entity to whom they
    are addressed. If you have received this email in error please notify
    the system manager.

    Katun Corporation -- Celebrating 25 Years of Service
    www.katun.com
    *********************************************************************************



    This archive was generated by hypermail 2.0.0 : Thu Jul 01 2004 - 09:57:42 EDT