This figure shows the mapping for a one-to-one relationship. A sample ejb-jar.xml
file is shown with the following code:
<relationships> ... <ejb-relation> ... <multiplicity>One</multiplicity> <relationship-role-source>EmpBean</relationship-role-source> <cmr-field> <cmr-field-name>address</cmr-field-name> </cmr-field> ... </ejb-relation> <ejb-relation> ... <relationship-role-source>AddressBean</relationship-role-source> ... </ejb-relation>
A sample orion-ejb-jar.xml
file is also shown, with the following code:
<entity-deployment name="EmpBean"... <cmp-field-mapping name="address"> <entity-ref home="AddressBean"> <cmp-field-mapping name="address" persistence-name="addressPK" /> </entity-ref> </cmp-field-mapping> ... </entity-deployment> entity-deployment name="AddressBean"... ... <cmp-field-mapping name="empNo"> <entity-ref home="EmpBean"> <cmp-field-mapping name="empNo" persistence-name="empno" /> </entity-ref> </cmp-field-mapping> ... </entity-deployment>
There are three arrows in this illustration:
From the <cmr-field-name>address</cmr-field-name>
line in ejb-jar.xml
to the <cmp-field-mapping name="address" persistence-name="addressPK" />
line in orion-ejb-jar.xml
.
From the <cmr-field-name>address</cmr-field-name>
line in ejb-jar.xml
to the <cmp-field-mapping name="address">
line in orion-ejb-jar.xml
.
From the <ejb-name>AddressBean</ejb-name>
line in ejb-jar.xml
to the <entity-ref home="AddressBean">
line in orion-ejb-jar.xml
.
There is also a note pointing to the <cmp-field-mapping name="address" persistence-name="addressPK" />
line in orion-ejb-jar.xml
indicating that this is the name of the database column for the foreign key.