Recursive relationship

Discussions

EJB design: Recursive relationship

  1. Recursive relationship (2 messages)

    Hi,

    how can I declare a recursive CMR for a Parent-Chrildren relation.

    Here's my actual DD

    <ejb-relation>
       <ejb-relation-name>Person-Child</ejb-relation-name>
       <ejb-relationship-role>

    <ejb-relationship-role-name>ParentOfChilds</ejb-relationship-role-name>
            <multiplicity>Many</multiplicity>
            <relationship-role-source>
              <ejb-name>PersonEJB</ejb-name>
            </relationship-role-source>
            <cmr-field>
              <cmr-field-name>children</cmr-field-name>
              <cmr-field-type>java.util.Collection</cmr-field-type>
            </cmr-field>
          </ejb-relationship-role>
       <ejb-relationship-role>

    <ejb-relationship-role-name>ChildrenHasParen</ejb-relationship-role-name>
            <multiplicity>Many</multiplicity>
            <relationship-role-source>
              <ejb-name>PersonEJB</ejb-name>
            </relationship-role-source>
          </ejb-relationship-role>
     </ejb-relation>

    The relationship is displayed correctly in deploytool. I tried with 1-N and
    M-N relation.
    But during deployment it only creates one table 'PersonEJBTable' and one
    table
    'PersonEJB_children_PersonEJB_Table'. The first one is correct is gets
    filled
    when I create Person entities. But the second table only has one column
    '_PersonEJB_name'
    and this one is not filled when I create a relationship like this

      InitialContext initial = new InitialContext();
      PersonLocalHome plh =
    (PersonLocalHome)initial.lookup("java:comp/env/ejb/local/Person");
      PersonLocal pl = plh.create(name);
      this.getChildren().add(pl);

    Can anyone tell me what I am doing wrong here?

    TIA
    Frank

    Threaded Messages (2)

  2. Recursive relationship[ Go to top ]

    I just saw that there's an SQLExcpetion: EOF encountered when I assign a child to a person. I found out that the STORE statement was not generated by deploytool.
    And the table for the relationship also seems to be wrong as one column is not sufficient to save the realtionship.

    Any suggestions?

    TIA
    Frank
  3. Recursive relationship[ Go to top ]

    Gee, whatever happened to good ole JDBC and SQL. I really don't see what is gained by using that CMR crap.