Many-to-Many CMR Relationship Issue
bchand Jan 28, 2002 9:56 AMHi,
I am hitting a strange issue. I am running JBoss 3.0 alpha. as downloaded from the website, not the CVS version. I am attempting to get a many to many relationship working. I have the CMP documentation and "attempted" to follow it. However, after much configuration I seem to not get this working. The problem is that once the get method that drives the relationship is called, JBoss looks like it hangs for LONG time, does nothing, and then the connection pool times out causing a transaction rollback exception. BTW long time means approx 5 min.
The question, did the non CVS version of JBoss 3.0 alpha implement many - to - many relationships correctly or should I take a chance with the CVS version? I am attaching snipets of my files ejb-jar.xml and jbosscmp-jdbc.xml I am hoping, and have a strong feeling that it is my configuration. Can anyone shed some light on this please.
One last thing. It is important to note that the ejb-jar.xml works correctly in weblogic. also the join table exists already in the database and should not be created. It is also of note that there is also other fields in the join table besides the key fields. This info may not amount to much but just thought I would toss it out anyways.
here are the snipets
ejb-jar.xml
<ejb-relation>
<ejb-relation-name>ShipmentUnit-Pallet</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>one-ShipmentUnit-Has-Many-Pallets</ejb-relationship-role-name>
Many
<relationship-role-source>
<ejb-name>ShipmentUnitBean</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>pallets</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-Pallet-Has-Many-ShipmentUnits</ejb-relationship-role-name>
Many
<relationship-role-source>
<ejb-name>PalletBean</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>shipmentUnits</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
and now for the jbosscmp-jdbc.xml
<ejb-relation>
<ejb-relation-name>ShipmentUnit-Pallet</ejb-relation-name>
<table-mapping>
<table-name>su_ptu</table-name>
<create-table>false</create-table>
<delete-table>false</delete-table>
<ejb-relationship-role>
<ejb-relationship-role-name>one-ShipmentUnit-Has-Many-Pallets</ejb-relationship-role-name>
<table-key-fields>
<table-key-field>
<field-name>tcn</field-name>
<column-name>su_id</column-name>
</table-key-field>
</table-key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>one-Pallet-Has-Many-ShipmentUnits</ejb-relationship-role-name>
<table-key-fields>
<table-key-field>
<field-name>id</field-name>
<column-name>pal_id</column-name>
</table-key-field>
<table-key-field>
<field-name>date</field-name>
<column-name>pal_dt</column-name>
</table-key-field>
</table-key-fields>
</ejb-relationship-role>
</table-mapping>
</ejb-relation>