0 Replies Latest reply on Aug 21, 2002 4:08 AM by Nagendra

    CMR - how to give two <cmr-field-name> tags in ejb-jar.xml

    Nagendra Newbie

      Hi,

      I have a Process table and a Successor table.
      Process table contains the following fields as the primary key fields : path_id, process_name
      Successor table contains the following fields as the primary key fields : path_id(fk), process_name(fk), successor_id

      I have defined a cmr method in ProcessBean
      Collection getSuccessors()

      the relationships portion of my ejb-jar.xml is

      <ejb-relation > <ejb-relation-name>Process-Sucessor</ejb-relation-name>
      <!-- unidirectional -->
      <ejb-relationship-role > <ejb-relationship-role-name>one-process-has-many-successors</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>Process</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>successors</cmr-field-name> <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role > <ejb-relationship-role-name>one-sucessor-belongs-to-one-process</ejb-relationship-role-name>
      Many
      <relationship-role-source >
      <ejb-name>Successor</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>pathId</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>


      My problem here is I am not being allowed to specify the <cmr-field-name>processName</cmr-field-name> in the Successor bean as it says only one <cmr-field-name> tag is allowed. As a result, I am unable to get the correct query.

      I am struggling with this for past three days. Any help would be greatly appreciated.

      Thanks,
      Nagendra

      P.S. I tried to put the foreign-key-mapping in the standardjbosscmp-jdbc.xml like this, but it is not useful either.

      <ejb-relation>
      <ejb-relation-name>Process-Sucessor</ejb-relation-name>
      <foreign-key-mapping>
      <ejb-relationship-role> <ejb-relationship-role-name>one-process-has-many-successors</ejb-relationship-role-name>
      <foreign-key-fields/>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>one-sucessor-belongs-to-one-process</ejb-relationship-role-name>
      <foreign-key-fields>
      <foreign-key-field>
      <field-name>path_id</field-name>
      <column-name>path_id</column-name>
      </foreign-key-field>
      <foreign-key-field>
      <field-name>process_name</field-name>
      <column-name>process_name</column-name>
      </foreign-key-field>
      </foreign-key-fields>
      </ejb-relationship-role>
      </foreign-key-mapping>
      </ejb-relation>