Hi!
I have VotingEntity which is an entity bean having a one-to-many
relationship between Question. The Question has a one-to-many relationship
between Choice.

+---------------------+
|   <<entity bean >>  |
|    VotingEntity     |
+---------------------+
         1 |
           |
         * V
+---------------------+
| <<dependent class>> |
|      Question       |
+---------------------+
         1 |
           |
         * V
+---------------------+
| <<dependent class>> |
|       Choice        |
+---------------------+

The relevant parts of code for each class:

public abstract class VotingEntityBean implements EntityBean {
    private EntityContext context;

    // cmp-fields
    public abstract void setId(Long id);

    public abstract Long getId();

    // cmr-fields
    public abstract void setQuestions(Collection questions);

    public abstract Collection getQuestions();

    public abstract Question createQuestion(Long id) 
            throws CreateException;
...
....
}

public abstract class Question {
    // cmp-fields
    public abstract void setId(Long id); // primary key

    public abstract Long getId(); // primary key

    public abstract void setText(String text);

    public abstract String getText();

    // cmr-fields
    public abstract void setChoices(Collection choices);

    public abstract Collection getChoices();

    public abstract Choice createChoice(Long choiceId);


    // Creators
    public Long ejbCreateQuestion(Long id) {
        this.setId(id);
        return null;
    }

    public void ejbPostCreateQuestion(Long id) {
    }

...
...
}

public abstract class Choice {
    public abstract void setId(Long id);

    public abstract Long getId();

    public abstract void setText(String text);

    public abstract String getText();

    public Long ejbCreateChoice(Long id) {
        this.setId(id);
        return null;
    }

    public void ejbPostCreateChoice(Long id) {
    }

...
...
}

And I have deployed these in a following way:

<enterprise-beans>
  <entity>
    <ejb-name>Voting</ejb-name>
    <home>voting.VotingEntityHome</home>
    <remote>VotingEntity</remote>
    <ejb-class>VotingEntityBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>True</reentrant>
    <cmp-field>
      <field-name>questions</field-name>
    </cmp-field>
    <cmp-field>
      <field-name>id</field-name>
    </cmp-field>
    <primkey-field>id</primkey-field>
  </entity>
</enterprise-beans>

<dependents>
  <dependent>
    <dependent-name>question</dependent-name>
    <dependent-class>voting.Question</dependent-class>
    <cmp-field>
      <field-name>id</field-name>
    </cmp-field>
    <cmp-field>
      <field-name>text</field-name>
    </cmp-field>
    <cmp-field>
      <field-name>choices</field-name>
    </cmp-field>
    <prim-key-class>java.lang.Long</prim-key-class>
    <primkey-field>id</primkey-field>
  </dependent>

   <dependent>
     <dependent-name>choice</dependent-name>
     <dependent-class>voting.Choice</dependent-class>
     <cmp-field>
       <field-name>id</field-name>
     </cmp-field>
     <cmp-field>
       <field-name>text</field-name>
     </cmp-field>
     <cmp-field>
       <field-name>answers</field-name>
     </cmp-field>
     <prim-key-class>java.lang.Long</prim-key-class>
     <primkey-field>id</primkey-field>
     </dependent>
</dependents>

<relationships>
    <ejb-relation>
      <ejb-relation-name>voting-question</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>
          voting-has-questions
        </ejb-relationship-role-name>
        <multiplicity>one</multiplicity>
        <role-source>
          <ejb-name>Voting</ejb-name>
        </role-source>
        <cmr-field>
          <cmr-field-name>questions</cmr-field-name>
          <cmr-field-type>java.util.Collection</cmr-field-type>
        </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
        <ejb-relationship-role-name>
          question-belongsto-voting
        </ejb-relationship-role-name>
        <multiplicity>many</multiplicity>
        <role-source>
          <dependent-name>question</dependent-name>
        </role-source>
      </ejb-relationship-role>
    </ejb-relation>

    <ejb-relation>
      <ejb-relation-name>question-choice</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>
          question-has-choices
        </ejb-relationship-role-name>
        <multiplicity>one</multiplicity>
        <role-source>
          <dependent-name>question</dependent-name>
        </role-source>
        <cmr-field>
          <cmr-field-name>choices</cmr-field-name>
          <cmr-field-type>java.util.Collection</cmr-field-type>
        </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
        <ejb-relationship-role-name>
          choice-belongsto-question
        </ejb-relationship-role-name>
        <multiplicity>many</multiplicity>
        <role-source>
          <dependent-name>choice</dependent-name>
        </role-source>
      </ejb-relationship-role>
    </ejb-relation>
</relationships>


But at deployment phase the Orion gives an error:

Error compiling file:voting.jar:
Illegal abstract method in dependent class
voting.Question: public abstract voting.Choice voting.Question.createChoice()


Can dependent objects have container managed relationships between other
dependent objects? Have I misinterpreted the spec (section 9.4.4.1) or is
this something which is not yet supported in Orion?

Joni
[EMAIL PROTECTED]


Reply via email to