Annotation Interface UniqueConstraint


@Documented @Retention(RUNTIME) @Target(TYPE) public @interface UniqueConstraint
Annotation to define a unique constraint on one or more database columns.

This annotation ensures that the specified columns have unique values in the database. The column names should correspond to the actual column names in the database, not the entity class field names.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies the names of the database columns that should have unique values.
  • Element Details

    • columnNames

      String[] columnNames
      Specifies the names of the database columns that should have unique values.
      Returns:
      An array of column names enforcing uniqueness.
      Default:
      {}