Jakarta Persistence (JPA) Annotation Type

jakarta.persistence.Index

Implemented Interfaces:
Annotation

Used in schema generation to specify creation of an index.

The syntax of the columnList element is given by the following simple BNF:

    column_list ::= index_column [, index_column]*
    index_column ::= column_name [ASC | DESC]

If neither ASC nor DESC is not specified, ASC, that is, ascending order, is assumed.

Note that it is not necessary to specify an index for a primary key, as the primary key has a unique constraint with an index created automatically.

See Also:
Since:
Jakarta Persistence (JPA) 2.1

Public Instance Methods

String columnList()
(Required) The columns included in the index, in order, following the BNF rule column_list given above.
Since:
Jakarta Persistence (JPA) 1.0
String name()
(Optional) The name of the index.

Defaults to a provider-generated name.

Since:
Jakarta Persistence (JPA) 1.0
String options()
(Optional) A SQL fragment appended to the generated DDL which creates this index.
Since:
Jakarta Persistence (JPA) 3.2
boolean unique()
(Optional) Whether the index is unique.
Since:
Jakarta Persistence (JPA) 1.0

Annotation Elements

This is a marker annotation with no members/elements.

Additional JDK methods inherited from java.lang.annotation.Annotation

java.lang.annotation.Annotation/annotationType(), java.lang.annotation.Annotation/equals(Object), java.lang.annotation.Annotation/hashCode(), java.lang.annotation.Annotation/toString()