-
1. Re: Controling the column-name used by Foreign Key Mapping
jcordes Mar 5, 2003 12:04 PM (in response to chrisdutz)Hi Chris !
The relation section in jbosscmp-jdbc.xml should read like this:
<ejb-relation>
<ejb-relation-name>WorkOrder-Assembly</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>WorkOrder-has-a-Assembly</ejb-relationship-role-name>
<foreign-key-fields/>
</foreign-key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Assembly-has-many-WorkOrders</ejb-relationship-role-name>
<foreign-key-fields>
<foreign-key-field>
<field-name>id</field-name>
<!-- Primary-Key von AssemblyEnt
-->
<column-name>wo_assembly_id</column-name>
<!-- name fo the column in the WorkOrderEnt-Table that stores the key-data
-->
</foreign-key-field>
</foreign-key-fields>
</ejb-relationship-role>
</ejb-relation>
So basically, you have to define the foreign-key in the section of the bean this foreign-key refers to. Then the foreign-key-field will be created in the table of the other participating bean.
Hope it helps,
Jochen. -
2. Re: Controling the column-name used by Foreign Key Mapping
chrisdutz Mar 6, 2003 5:14 AM (in response to chrisdutz)Thanks for your help, but It seems something else was wrong. Once again I seem to have mixed up hints for older JBoss versions and new ones. I had to add a <foreign-key-mapping/> field and call the other fields <key-fields> and <key-field>.
But I wouldn't have come very far if you hadn't given me that tip, because I also had to swap the entries ... thanx a lot :)