4 Replies Latest reply on May 22, 2002 11:29 AM by Peter Backlund

    CMR problem - key-fields not detected

    Peter Backlund Newbie

      Hello.

      I am unable to solve this problem, so any help is greatly appreciated.

      (Using JB 3.0rc1/JDK 1.3.1/XDoclet 1.1.2 on Linux)

      I have a large tree-like structure of CMP entity beans, joined together by unidirectional one-one and one-many relations. However, I can't get them to deploy due to the following error:

      org.jboss.deployment.DeploymentException: error in create of EjbModule: file:/opt/jboss-3.0.0RC1/server/default/deploy/provbanken-ejb.jar; - nested throwable is: org.jboss.deployment.DeploymentException: Atleast one role of a foreign-key mapped relationship must have key fields: ejb-relation-name=<my relation name here>

      (+ stack trace, which I will post if there's a need for it.)

      Now, here's what my jbosscmp-jdbc.xml looks like:

      (one sample relation, they are all very similar, and each time I try and deploy the beans, a different relation causes the error)

      [snip]

      <ejb-relation>
      <ejb-relation-name>parent-child</ejb-relation-name>
      <foreign-key-mapping/>
      <ejb-relationship-role>
      <ejb-relationship-role-name>parent-has-many-children</ejb-relationship-role-name>
      <key-fields/>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>child-belongs-to-parent</ejb-relationship-role-name>
      <fk-constraint>true</fk-constraint>
      <key-fields>
      <key-field>
      <field-name>pk</field-name>
      <column-name>FK_PARENT</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      </ejb-relation>

      This is supposed to be a unidirectional relation, i.e. the children don't know about their parents. As far as I can tell from the CMP documentation, this should be correct. Could someone tell me what's wrong, because I'm lost...thanks in advance.

      /Peter Backlund
      University of Umeå, Sweden