Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.annotations
Annotation Type PrimaryKey


@Target(value=TYPE)
@Retention(value=RUNTIME)
public @interface PrimaryKey

The PrimaryKey annotation allows advanced configuration of the Id. A validation policy can be given that allows specifying if zero is a valid id value. The set of primary key columns can also be specified precisely.

Since:
EclipseLink 1.1
Author:
James Sutherland

Optional Element Summary
 CacheKeyType cacheKeyType
          (Optional) Configures what cache key type is used to store the object in the cache.
 javax.persistence.Column[] columns
          (Optional) Used to specify the primary key columns directly.
 IdValidation validation
          (Optional) Configures what id validation is done.

 

validation

public abstract IdValidation validation
(Optional) Configures what id validation is done. By default 0 is not a valid id value, this can be used to allow 0 id values.
Default:
org.eclipse.persistence.annotations.IdValidation.ZERO

cacheKeyType

public abstract CacheKeyType cacheKeyType
(Optional) Configures what cache key type is used to store the object in the cache. By default the type is determined by what type is optimal for the class.
Default:
org.eclipse.persistence.annotations.CacheKeyType.AUTO

columns

public abstract javax.persistence.Column[] columns
(Optional) Used to specify the primary key columns directly. This can be used instead of @Id if the primary key includes a non basic field, such as a foreign key, or a inheritance discriminator, embedded, or transformation mapped field.
Default:
{}

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.