Top Description Methods
jakarta.persistence

public @Interface Index

extends Annotation
Annotations
@Target
@Retention:RUNTIME
Static Imports
java.lang.annotation.RetentionPolicy.RUNTIME

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

Since
2.1
See Also
Table, SecondaryTable, CollectionTable, JoinTable, TableGenerator

Method Summary

Modifier and TypeMethod and Description
public String
columnList()

(Required) The columns included in the index, in order, following the BNF rule column_list given above.

public String
name()

(Optional) The name of the index.

public String
options()

(Optional) A SQL fragment appended to the generated DDL which creates this index.

public boolean
unique()

(Optional) Whether the index is unique.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

columnListback to summary
public String columnList()

(Required) The columns included in the index, in order, following the BNF rule column_list given above.

nameback to summary
public String name()

(Optional) The name of the index.

Defaults to a provider-generated name.

optionsback to summary
public String options()

(Optional) A SQL fragment appended to the generated DDL which creates this index.

Since
3.2
uniqueback to summary
public boolean unique()

(Optional) Whether the index is unique.