I have been playing around w/ CMR fields with many/many relationship. I have 2 tables w/ a corresponding link table. I am very confused as to what the proper jbosscmp-jdbc.xml syntax should look like. This is the fragment from the file:
<ejb-relation>
<ejb-relation-name>Hosts-Groups</ejb-relation-name>
<relation-table-mapping>
<table-name>hosts_groups_lnk</table-name>
</relation-table-mapping>
<ejb-relationship-role>
<ejb-relationship-role-name>hosts-have-groups</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>groupNumber</field-name>
<column-name>group_number</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>groups-have-hosts</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>node</field-name>
<column-name>node</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
This is the error I am getting:
17:15:37,219 INFO [EjbModule] Remove JSR-77 EJB Module: jboss.management.single:J2EEApplication= ,J2EEServer=Single,j2eeType=EJBModule,name=ejb-bbcpu.jar
17:15:37,221 ERROR [EjbModule] Initialization failed
org.jboss.deployment.DeploymentException: CMP field for key not found: field name=groupNumber
Any help would be appreciated.
- Partha Dutta
This is covered in the JBossCMP documentation available at FlashLine. My guess is you have the keys on the wrong side of the relationship.