2 Replies Latest reply on Oct 10, 2002 10:50 PM by Sreeni

    ONE to MANY unidirectional Mapping

    Sreeni Newbie

      Hi ,


      I am facing problem when I try to do one to many
      mapping (jboss-3.0.0_tomcat-4.0.3).


      1 CUSTOMER - MANY PHONE NUMBERS

      IN my ejb-jar.xml, the entry looks like

      <ejb-relation >
      <ejb-relation-name>customer-phonenumbers</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>customer-has-phonerole</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>Customers</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>phoneNumbers</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>phonenumbers-belongs-tocustomer-role</ejb-relationship-role-name>
      Many
      <relationship-role-source >
      <ejb-name>Phone</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      jbosscmp-jdbc.xml, looks like

      <ejb-relation>
      <ejb-relation-name>customer-phonenumbers</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>customer-has-phonerole</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>custId</field-name>
      <column-name>custId</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>phonenumbers-belongs-tocustomer-role</ejb-relationship-role-name>
      <key-fields/>
      </ejb-relationship-role>
      </ejb-relation>

      When I deploy the jar file, I am getting exception - Saying

      Element "ejb-relation" does not allow "ejb-relati
      onship-role" here.


      EXCEPTION:
      ---------

      /default/tmp/deploy/server/default/deploy/CUSTOMER_REL_1-M.jar/110.CUSTOMER_REL_
      1-M.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 196. Error message:
      org.xml.sax.SAXParseException: Element "ejb-relation" does not allow "ejb-relati
      onship-role" here.
      at org.apache.crimson.parser.Parser2.error(Parser2.java:3086)
      at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(
      ValidatingParser.java:349)


      Please help me in correcting this problem.

      Thanks,
      Sreeni