Skip Headers

# Configuring Primary Keys

Previous

Next

A primary key is a unique identifier (made up of one or more persistent attributes) that distinguishes one instance of a class from all other instances of the same type. You use primary keys to define relationships and to define queries.

For the descriptors shown in Table: Descriptor Support for Primary Keys, you must configure a primary key and you must ensure that your class contains one or more persistent fields suitable for this purpose.

Table: Descriptor Support for Primary Keys summarizes which descriptors support primary keys.

Descriptor Support for Primary Keys

Descriptor | Using TopLink Workbench | Using Java
--- | --- | ---
Relational DescriptorsFoot 1 |  |
Object-Relational Descriptors |  |
EIS DescriptorsFoot 2 |  |
XML Descriptors |  |

Footnote 1 Relational class descriptors only (see "Relational Class Descriptors").

Footnote 2 EIS root descriptors only (see "EIS Root Descriptors").

For a relational class (non-aggregate) descriptor, choose any unique database field or set of unique database fields from the descriptor's associated table (see "Configuring Associated Tables").

For an EIS root descriptor (see "Configuring an EIS Descriptor as a Root or Composite Type"), choose any unique attribute or text node or set of unique attributes or text nodes from the descriptor's schema context (see "Configuring Schema Context for an EIS Descriptor").