One to many relationships require reverse relationships?

From: Merritt, Scott (Scott.Merrit..amu.net)
Date: Thu Apr 24 2003 - 13:17:07 EDT

  • Next message: Andrus Adamchik: "Re: One to many relationships require reverse relationships?"

    I saw the many-to-many relationship example in the users guide but am
    wondering why I have to create reverse relationships even when I build a
    one-to-many relationship?

    For example, I have a site table that contains website information and a
    table of users branched off that. A site has many users and I'd like to
    create a simple way to get access to these users by which site they
    belong to. (IE, user table has a site_id in it.) Why would I have to
    create a relationship back from the user object to the site if I'm never
    going to do that? If I don't when I insert a site & user in a
    transaction the site_id is null in the user insert and... boom. Once I
    create the reverse relationship everything works.

    Don't get me wrong, Cayenne does have one of the better user guides I've
    seen for open source software, especially after reading some Castor and
    Jakarta OJB docs... (or what exists.)

    I'm using MySQL by the way...

    -smerritt



    This archive was generated by hypermail 2.0.0 : Thu Apr 24 2003 - 13:17:06 EDT