ObjectExtender User's Guide and Reference

Creating one-to-one (1-1) relationships

The Bank sample uses a one-to-one relationship for the VapAddress and the VapCustomer business objects. This topic explains how to create a one-to-one relationship using the ObjectExtender tools.

Do the following:

It was created as follows:

  1. Select New Association from the Associations menu.

    This launches the Association Editor.


    Figure pgs2a not displayed.

  2. In the Association name field, type Customer-BillingAddress.
  3. Define the two Class sections.
    1. In the left Class pane, select VapCustomer.
    2. In the right Class pane, select VapAddress.
    3. Type billingAddress for Role of VapAddress.
      • Select Navigable.

        This means VapAddress can be obtained from the VapCustomer object.

        Leave Many and Required unselected. This sets a cardinality of zero-to-one (0:1). When a cardinality of one-to-one (1:1) is desired, select Required.

    4. Type customerForBillingAddress for Role of VapCustomer.
    5. Select Navigable.

      This means VapCustomer can be obtained from the VapAddress object.

      Leave Many and Required unselected.

  4. Select OK.

You are now done with the Model Browser. The one-to-one relationship is defined.

Next, defining this relationship using schema semantics is shown. Mapping the schema to the model will be the last step covered. These combined tasks provide the required information for creating persistence support for your business objects.

Do the following:

It was created as follows:

  1. Select Foreign Key Relationship from the Foreign_Keys menu.

    This launches the Foreign Key Relationship editor.


    Figure pgs2b not displayed.

  2. Type customer-billingaddress for the Name.
  3. Type R7 for the Physical Name.
  4. If a foreign key constraint does not exist on the database, make sure Constraint exists in database is not selected.
  5. Update the Relationship section:
    1. Select ADDRESS for the Primary key table.

      The Primary key column (read-only) will be updated with the primary key from the table.

    2. Select CUSTOMER for the Foreign key table.

      In the Foreign key column, select the foreign key in the CUSTOMER table which corresponds to the billing address, BILLADDR.

  6. Select OK.

You are now done with the Schema Browser.

To complete the last step in defining the persistence layer for the one-to-one relationship.

It was created as follows:

  1. Select Bank Sample from the Datastore Maps view, VapCustomer from the Persistent Classes view, and CUSTOMER from the Table Maps view.
  2. Select Edit Property Maps from the Table_Maps menu.

    This launches the Property Map Editor.

  3. Click the Associations tab.


    Figure pgs2c not displayed.

  4. Change the [Not Mapped] value of the billingAddress association to customer-billingaddress under Foreign Key Relationships.
  5. Select OK.

This concludes defining the persistence layer for the one-to-one relationship.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]