Following the discussion of this thread,
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= I have a question on the jbosscmp-jdbc.xml too. Now that I have my ejb-jar.xml working in which it describes a Many-to-One relationship, just like Cruise-to-Ship. So I expect my 'Cruise' table will have a 'ship' field, right. But I want it 'ship_id' instead. So in my jbosscmp-jdbc.xml I define it as,
--- jbosscmp-jdbc.xml---
<ejb-relation>
<ejb-relation-name>Cruise-Ship</ejb-relation-name>
<relation-table-mapping>
<table-name>Cruise</table-name>
<create-table>true</create-table>
<remove-table>true</remove-table>
</relation-table-mapping>
<ejb-relationship-role>
<ejb-relationship-role-name>Cruise-has-a-Ship</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>ship</field-name>
<column-name>SHIP_ID</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Ship-has-many-Cruise</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
</ejb-relation>
---------
But as in the given ejb-jar.xml of the exercise, the 'ship' field is not defined as a key nor a cmp-field, so the jbosscmp-jdbc.xml won't work.
I really wonder if one were to write a jbosscmp-jdbc.xml for ex07_2 of the book, especially the Cruise-Ship relationship; how it might look like. Thanks for your attention.
kenny