Skip Headers
Oracle® Application Server TopLink Mapping Workbench User's Guide
10g Release 2 (10.1.2)
Part No. B15900-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Working with Primary Keys

A primary key is a column (or a combination of columns) that contains a unique identifier for every record in the table. In the OracleAS TopLink Mapping Workbench, every table that stores persistent objects must have a primary key. Tables that require multiple columns to create an identifier use a composite primary key. Setting the primary key for a table also sets the primary key for the descriptor that uses the table.

The OracleAS TopLink Mapping Workbench implements primary keys using sequence numbers (see "Working with Sequencing").

Each descriptor must provide mappings for its primary key. These mappings may be direct, transformation, or one-to-one. The OracleAS TopLink Mapping Workbench does not require you to define a primary key constraint in the database — only that the fields specified for the primary key are unique.


Note:

Primary keys for classes in an inheritance hierarchy or for descriptors that map to multiple tables have special requirements. Refer to"Working with Inheritance" and "Working with Multiple Tables" for more information.

Setting a Primary Key for Descriptors

Use this procedure to set a primary key for a descriptor.

To set a primary key:

  1. Select a descriptor in the Navigator pane. Its properties appear in the Editor pane.

  2. Click the Descriptor Info tab.

  3. Select the field(s) to set as the primary key.