Hi all,
I am working with last nights CVS build of JBoss 3.1.0x, and am trying to implement a straightforward unidirectional one-to-one relationship. We have ContactEJB and an EmailEJB, where the contact has one preferred Email address. The ejb-jar relationship decriptor is at the bottom of this post.
The problem is that JBoss is inserting a foreign key field in the Email table, which is not supposed to be there. We have noticed this is an ongoing problem since 3.0.0 final release. We have no problems with any other relationship type. We are not using a jbosscmp-jdbc.xml at the moment (appears to be no need), and would prefer not to use any non-standard deployment config.
<ejb-relation>
<ejb-relation-name>contact-preferredemailaddress</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>contact-has-preferredemailaddress</ejb-relationship-role-name>
<relationship-role-source>
<ejb-name>contact</ejb-name>
</relationship-role-source>
<multiplicity>One</multiplicity>
<cmr-field>
<cmr-field-name>preferredEmailAddress</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>preferredemailaddress-belongs-to-contact</ejb-relationship-role-name>
<relationship-role-source>
<ejb-name>emailAddress</ejb-name>
</relationship-role-source>
<multiplicity>One</multiplicity>
</ejb-relationship-role>
</ejb-relation>
Take a look at the quick start guide for information on exact database mapping for relationships.