2 Replies Latest reply on Apr 29, 2007 4:51 AM by amit deshpande

    help:A problem with cmr+auto-increment+composite keys

    shy613 Newbie


      My job have four EJBs, individualDetail->companyBranch,individualDetail->address,companyBranch->address,companyBranch->companyMaster

      when i deploymeny,the message is&#65306;Atleast one role of a foreign-key mapped relationship must have key fields (or <primkey-field> is missing from ejb-jar.xml): ejb-relation-name=individualDetail-companyBranch


      1.ejb-jar.xml

      <display-name>AddressBean</display-name>
      <ejb-name>AddressBean</ejb-name>
      <local-home>org.vp.eservice.user.ejb.AddressLocalHome</local-home>
      org.vp.eservice.user.ejb.AddressLocal
      <ejb-class>org.vp.eservice.user.ejb.AddressBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Object</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Address</abstract-schema-name>
      <!--<cmp-field>
      <field-name>addressID</field-name>
      </cmp-field>-->
      ... ...
      <!--<primkey-field>addressID</primkey-field>-->


      <display-name>CompanyBranchBean</display-name>
      <ejb-name>CompanyBranchBean</ejb-name>
      <local-home>org.vp.eservice.user.ejb.CompanyBranchLocalHome</local-home>
      org.vp.eservice.user.ejb.CompanyBranchLocal
      <ejb-class>org.vp.eservice.user.ejb.CompanyBranchBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>org.vp.eservice.user.ejb.CompanyBranchPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>CompanyBranch</abstract-schema-name>
      <cmp-field>
      <field-name>masterID</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>branchID</field-name>
      </cmp-field>
      ... ...


      <ejb-relation>
      <ejb-relation-name>individualDetail-companyBranch</ejb-relation-name>
      <ejb-relationship-role>
      individualDetailBean
      <ejb-relationship-role-name>IndividualDetailRelationshipRole</ejb-relationship-role-name>
      Many
      <relationship-role-source>
      individualDetailBean
      <ejb-name>IndividualDetailBean</ejb-name>
      </relationship-role-source>
      <cmr-field>
      companyBranchBean
      <cmr-field-name>companyBranch</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      companyBranchBean
      <ejb-relationship-role-name>CompanyBranchRelationshipRole</ejb-relationship-role-name>
      One
      <relationship-role-source>
      companyBranchBean
      <ejb-name>CompanyBranchBean</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      ... ...

      2.jbosscmp-jdbc.xml
      <jbosscmp-jdbc>
      <enterprise-beans>

      <ejb-name>AddressbBean</ejb-name>
      <table-name>Address</table-name>
      <unknown-pk>
      <unknown-pk-class>java.lang.Integer</unknown-pk-class>
      <!--<field-name>addressID</field-name>-->
      <column-name>AddressID</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      <auto-increment/>
      </unknown-pk>
      <entity-command name="mssql-fetch-key"/>
      ... ...

      <ejb-relation>
      <ejb-relation-name>individualDetail-companyBranch</ejb-relation-name>
      <foreign-key-mapping/>
      <ejb-relationship-role>
      <ejb-relationship-role-name>IndividualDetailRelationshipRole</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>masterID</field-name>
      <column-name>MasterID</column-name>
      </key-field>
      <key-field>
      <field-name>branchID</field-name>
      <column-name>BranchID</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>CompanyBranchRelationshipRole</ejb-relationship-role-name>
      <key-fields/>
      </ejb-relationship-role>
      </ejb-relation>
      ... ...


      can you help me?