Annotation Interface Index


@Target({}) @Retention(RUNTIME) public @interface Index
Used in schema generation to specify creation of an index.

The syntax of the columnList element depends on the SQL dialect, but is usually a comma-separated list of column names, with an optional ordering specification, ASC or DESC.

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:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    (Required) The columns included in the index, in order, following the BNF rule column_list given above.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    (Optional) The name of the index.
    (Optional) A SQL fragment appended to the generated DDL which creates this index.
    (Optional) A SQL fragment indicating the type of index, usually inserted before the keyword index in the generated DDL which creates this index.
    boolean
    (Optional) Whether the index is unique.
    (Optional) A SQL fragment representing the indexing method.
  • Element Details

    • name

      String name
      (Optional) The name of the index.

      Defaults to a provider-generated name.

      Default:
      ""
    • columnList

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

      boolean unique
      (Optional) Whether the index is unique.
      Default:
      false
    • type

      String type
      (Optional) A SQL fragment indicating the type of index, usually inserted before the keyword index in the generated DDL which creates this index.

      For example, type = "UNIQUE" results in CREATE UNIQUE INDEX ....

      Since:
      4.0
      Default:
      ""
    • using

      String using
      (Optional) A SQL fragment representing the indexing method. When specified, it is inserted into the generated DDL which creates this index, usually following a USING keyword.

      For example, using = "BTREE" results in CREATE INDEX ... USING BTREE ....

      Since:
      4.0
      Default:
      ""
    • options

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

      For example, options = "INCLUDE (total)" results in CREATE INDEX ... INCLUDE (total).

      Since:
      3.2
      Default:
      ""