@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Unique { /** Name of the unique constraint. * @return the name of the unique constraint */ String name() default ""; /** Table for the unique constraint. This is needed iff annotating a type * where this unique constraint is not for the primary table for * the persistent class or interface. * @return the table on which the unique constraint is defined */ String table() default ""; /** Whether this unique constraint is deferred until commit. * @return whether this unique constraint is deferred until commit */ String deferred() default ""; /** Member (field and property) names that compose this unique constraint. * @return member names that compose this unique constraint */ String[] members() default {}; /** Columns that compose this unique constraint. * @return columns that compose this unique constraint */ Column[] columns() default {}; }