1 Reply Latest reply on Dec 10, 2003 9:10 AM by Carlos Eugenio

    No ejb-relationship-role-name element found???

    Carlos Eugenio Newbie

      Hi,

      I've been looking for a clue to solve this for too long by now! I'm trying to do a simple example using relationships in Jboss 3.2(Customer, Address - many to many using a table with an attribute, actually implementing a CustomerAddress table) and at deployment time I get the following:

      <!--JBoss Version-->
      10:23:00,840 INFO [Server] Release ID: JBoss [WonderLand] 3.2.2 (build: CVSTag=
      JBoss_3_2_2 date=200310182216)
      ...
      10:49:53,198 INFO [EjbModule] Deploying LocalCustomerEJB
      10:49:53,218 INFO [EjbModule] Deploying LocalAddressEJB
      10:49:53,238 INFO [EjbModule] Deploying LocalCustomer_AddressEJB
      10:49:53,278 INFO [EjbModule] Deploying CustomerManyManyBEJB
      10:49:54,340 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: No ejb-relationship-role-name element
      found

      ...

      I have checked over and over the deployment descriptors for the problem but could not find the problem. Does any one have a clue?

      JBOSSCMP-JDBC3.0:
      <jbosscmp-jdbc>

      ...
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>

      <enterprise-beans>

      <ejb-name>LocalCustomerEJB</ejb-name>
      <table-name>Customer</table-name>
      <!--Other CmpFields --->
      ...
      <cmp-field>
      <field-name>pkid</field-name>
      <column-name>pkid</column-name>
      </cmp-field>
      <!-- Query Methods omited... -->


      <ejb-name>LocalAddressEJB</ejb-name>
      <table-name>Address</table-name>
      <!--Other CmpFields --->
      ...
      <cmp-field>
      <field-name>pkid</field-name>
      <column-name>pkid</column-name>
      </cmp-field>
      <!-- Query Methods omited... -->


      <ejb-name>LocalCustomer_AddressEJB</ejb-name>
      <table-name>Customer_Address</table-name>
      <cmp-field>
      <field-name>situacao</field-name>
      <column-name>situacao</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>pkid</field-name>
      <column-name>pkid</column-name>
      </cmp-field>
      <!-- Query Methods omited... -->

      </enterprise-beans>
      <!-- Relationships -->

      <ejb-relation>
      <ejb-relation-name>Associacao-Customer-Customer_Address</ejb-relation-name>
      <foreign-key-mapping />
      <ejb-relationship-role>
      <ejb-relationship-role-name>Customer-Customer_Address</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>pkid</field-name>
      <column-name>Customer_PK</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Customer_Address-Customer</ejb-relationship-role-name>
      <!--<key-fields />-->
      </ejb-relationship-role>
      </ejb-relation>

      <ejb-relation>
      <ejb-relation-name>Associacao-Address-Customer_Address</ejb-relation-name>
      <foreign-key-mapping />
      <ejb-relationship-role>
      <ejb-relationship-role-name>Address-Customer_Address</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>pkid</field-name>
      <column-name>Address_PK</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Customer_Address-Address</ejb-relationship-role-name>
      <key-fields />
      <!--<key-fields />-->
      </ejb-relationship-role>
      </ejb-relation>


      <!-- End Relationships -->
      </jbosscmp-jdbc>

      EJB-JAR.xml
      <ejb-jar>
      <display-name>CustomerManyManyB Session Bean</display-name>
      <enterprise-beans>

      <ejb-name>CustomerManyManyBEJB</ejb-name>
      com.engeny.customermmb.CustomerManyManyBHome
      com.engeny.customermmb.CustomerManyManyBRemote
      <ejb-class>com.engeny.customermmb.CustomerManyManyBService</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      ...


      <ejb-name>LocalCustomerEJB</ejb-name>
      <local-home>com.engeny.customermmb.LocalCustomerHome</local-home>
      com.engeny.customermmb.LocalCustomerRemote
      <ejb-class>com.engeny.customermmb.LocalCustomerEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Customer</abstract-schema-name>
      <!--Other CmpFields --->
      ...
      <cmp-field>
      <field-name>pkid</field-name>
      </cmp-field>
      <primkey-field>pkid</primkey-field>
      <!-- Query Methods -->
      ...


      <ejb-name>LocalAddressEJB</ejb-name>
      <local-home>com.engeny.customermmb.LocalAddressHome</local-home>
      com.engeny.customermmb.LocalAddressRemote
      <ejb-class>com.engeny.customermmb.LocalAddressEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Address</abstract-schema-name>
      <!--Other CmpFields --->
      ...
      <cmp-field>
      <field-name>pkid</field-name>
      </cmp-field>
      <primkey-field>pkid</primkey-field>
      <!-- Query Methods omited... -->
      ...


      <ejb-name>LocalCustomer_AddressEJB</ejb-name>
      <local-home>com.engeny.customermmb.LocalCustomer_AddressHome</local-home>
      com.engeny.customermmb.LocalCustomer_AddressRemote
      <ejb-class>com.engeny.customermmb.LocalCustomer_AddressEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Customer_Address</abstract-schema-name>
      <cmp-field>
      <field-name>situacao</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>pkid</field-name>
      </cmp-field>
      <primkey-field>pkid</primkey-field>
      <!-- Query Methods omited... -->

      </enterprise-beans>

      <ejb-relation>
      Associacao-Customer-Customer_Address
      <ejb-relation-name>Associacao-Customer-Customer_Address</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relatioship-role-name>Customer-Customer_Address</ejb-relatioship-role-name>
      One
      <relationship-role-source>
      <ejb-name>LocalCustomerEJB</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>colCustomer_Address</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relatioship-role-name>Customer_Address-Customer</ejb-relatioship-role-name>
      Many
      <relationship-role-source>
      <ejb-name>LocalCustomer_AddressEJB</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>
      <ejb-relation>
      Associacao-Address-Customer_Address
      <ejb-relation-name>Associacao-Address-Customer_Address</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relatioship-role-name>Address-Customer_Address</ejb-relatioship-role-name>
      One
      <relationship-role-source>
      <ejb-name>LocalAddressEJB</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>colCustomer_Address</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relatioship-role-name>Customer_Address-Address</ejb-relatioship-role-name>
      Many
      <relationship-role-source>
      <ejb-name>LocalCustomer_AddressEJB</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>CustomerManyManyBEJB</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      Any help would be appreciated.

      Thanks.

      Eugenio.