In jbosscmp-jdbc.xml, the <key field> is specified to indicate the primary key of the current entity used in the relationship. How does JBoss know what the foreign key is ?
For example ... a 1 to 1 relationship between UserEJB and CustomerEJB. The primary key in UserEJB table is username and I want to link this to the email column in CustomerEJB table. So tyhe customer's email will be used as their username. In jbosscmp-jdbc.xml, I only specify username in key fields. How does JBoss know to link this username to CustomerEJB' table's email column ?
<ejb-relation>
<ejb-relation-name>User-Customer</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>one-CustomerEJB@user-Has-UserEJB</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>one-UserEJB@customer-Has-CustomerEJB</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>username</field-name>
<column-name>username</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>