Mapping Relationships to Existing Tables
If you engineer entity beans from database tables, foreign keys are
interpreted as EJB relationships. However, if you have existing entity
beans and existing database tables, you will need to map the
relationships accordingly.
To map entity bean relationships, you use the Relationship Mappings
editor.
To map CMR relationships:
-
If you have not already done so, establish a connection to the
database schema(s) you want to use.
-
In the Navigator, right-click on an entity bean and choose
Edit CMP Mappings.
The CMP Field Mappings editor opens.
-
Click on the Relationship Mappings tab.
-
Use the CMP Relationship Mappings editor to map relationships.
For
additional help in the editor, click Help
in the dialog or press F1.
Note: If you are
migrating to JDeveloper 10.1.2, you need to redefine all CMR
relationships by selecting each relationship in the mapping editor.
Simply visiting each relationship in the editor will apply the fix.
Note: The Association Table checkbox may become selected by default
under some circumstances (changing a table name, for example). This
happens because the mapping tool tests for whether an association
table is being used by comparing the table specified in the
collection-mapping (1 end of a 1:* relationship) with the table used
by the * end of the CMP field mapping. If they are different, the
mapping tool indicates an intersection table is being used, though it
may be detecting pre-existing field mappings.
Note:
A single column can map to both a CMP field and a CMR field, but a field is
either
CMP or CMR but not both. For compound primary keys, one
field may be mapped to a CMP field and the other to a CMR field.
Related topics
Creating a Diagram of Enterprise JavaBeans
Developing Enterprise JavaBeans
What are Enterprise JavaBeans?
Copyright © 1997, 2004, Oracle.
All rights reserved.