Help: ?Cyclic? Many to Many relationship

From: Noel Murphy (bnmurph..ogers.com)
Date: Sat Oct 18 2003 - 15:45:17 EDT

  • Next message: Eric Schneider: "Re: Updated Tapestry/Cayenne examples"

    Hello,

    I've been trying to use cayenne for a few days now and I've come across
    a problem I just can't seem to get around / figure out.

    I have 2 tables. One called Person, the other called Parent_Child. The
    structure of each is:

    **Person**
    ID -> Integer (Primary Key)
    Name -> varchar

    **Parent_Child**
    parent_id -> Integer
    child_id -> Integer

    As you may have guessed, each row of the parent_child table simply
    stores the Person_IDs of a parent and child.

    So, using the modeler, how do you set this up? I can't seem to get it
    right to save my life. I want to have a method on my resulting Person
    Object called, "getChildren" which returns all of the children for the
    given person AND I want a method called "getParents" which would return
    a list of the parents for the given person. The best I've been able to
    get to happen is either the list is null or I get the root person back
    (i.e. when i ask for my children, I get myself, etc).

    Can anyone help me? The tutorials (in their current state), don't have
    an example of this.

    Noel Murphy



    This archive was generated by hypermail 2.0.0 : Sat Oct 18 2003 - 15:45:26 EDT