Creating One-to-Many Mappings

With the TopLink Mapping editor, you can create both unidirectional or bidirectional one-to-many (1:M) mappings between CMP EJBs. These mappings can be either privately owned or independent.

If the one-to-many mapping is not read-only, the foreign key is stored on the target and must be updated when writing the object. This requires you to:

or

To create a one-to-many mapping:

Use this procedure to create a one-to-many mapping.

  1. In the Structure window, select the attribute to be mapped.
  2. Enter the required information to define this mapping.
  3. Click the One-to-Many Mapping - Collection Options tab.

    Figure 6-9 One-to-Many Mapping Collection Options

    This figure shows the Collection Options tab of a one-to-many mapping.

  4. Enter the collection information for this mapping.
  5. Click the One-to-Many Mapping - Table Reference tab.

    Figure 6-10 One-to-Many Mapping Collection Options

    This figure shows the Table Reference tab of a one-to-one many mapping.

  6. Choose the Table Reference and foreign key(s).

Related Topics

About CMP EJB Mappings
Working with CMR Relationship Mappings

 

Working with One-to-Many Mappings

 

Copyright © 1997, 2004, Oracle. All rights reserved.