Here are snippets from jbosscmp-jdbc.xml and ejb-jar.xml:
jbosscmp-jdbc.xml:
<ejb-relation>
<ejb-relation-name>my relation name</ejb-relation-name>
<relation-table-mapping>
<table-name>MY_TABLE</table-name>
</relation-table-mapping>
<ejb-relationship-role>
<ejb-relationship-role-name>MyBeanRelationshipRole</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>myBeanID</field-name>
<column-name>myBeanID</column-name>
</key-field>
<key-field>
<field-name>anotherID</field-name>
<column-name>anotherID</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>MyOtherBeanRelationshipRole</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>testID</field-name>
<column-name>testID</column-name>
</key-field>
<key-field>
<field-name>myOtherBeanID</field-name>
<column-name>myOtherBeanID</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
This is what remains after switching to EJB Designer, selecting the relation and switchung back to source code:
<ejb-relation>
<ejb-relation-name>my relation name</ejb-relation-name>
<relation-table-mapping>
<table-name>MY_TABLE</table-name>
</relation-table-mapping>
</ejb-relation>
Here's the corresponding part of ejb-jar.xml:
<ejb-relation>
<ejb-relation-name>my relation name</ejb-relation-name>
<ejb-relationship-role>
<description>myBean</description>
<ejb-relationship-role-name>MyBeanRelationshipRole</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<description>myBean</description>
<ejb-name>MyBean</ejb-name>
</relationship-role-source>
<cmr-field>
<description>myOtherBean</description>
<cmr-field-name>myOtherBeanBelongsTo</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<description>myOtherBean</description>
<ejb-relationship-role-name>MyOtherBeanRelationshipRole</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<description>myOtherBean</description>
<ejb-name>myOtherBean</ejb-name>
</relationship-role-source>
<cmr-field>
<description>myBean</description>
<cmr-field-name>myBeanBelongsTo</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
I hope someone has a glue. I don't...
Cheers
> I have a 1:1 bidirectional relationship between two entity beans through an extra table.
Here's the old saw, oft repeated in this newsgroup:
EJBs are not JavaBeans (not until EJB 3.0, that is; and then
they'll be called Hibernate POJOs -- smileys needed?).
Seek answers for EJB questions/problems in the "enterprise"
newsgroup.
--
Paul Furbacher (TeamB)
Save time, search the archives:
http://www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.