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 TopLink Mapping editor, 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.

TopLink 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. TopLink 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.

Related Topics

About TopLink Descriptors

Working with Descriptors
Setting a Primary Key for Descriptors

 

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