JPA Annotation

UniqueConstraint

Implemented Interfaces:
Annotation

Specifies that a unique constraint is to be included in the generated DDL for a primary or secondary table.

Example:

 {@snippet :
Since:
JPA 1.0

Public Annotation Attributes

String[] columnNames default null
(Required) The names of the column which make up the constraint.
Since:
JPA 1.0
String name default ""
(Optional) The name of the constraint.

Defaults to a provider-generated name.

Since:
JPA 2.0
String options default ""
(Optional) A SQL fragment appended to the generated DDL which creates this constraint.
Since:
JPA 3.2