Annotation Interface UniqueKey


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface UniqueKey
Specifies the "unique" attribute of an entity that is always non-null and there can be no other entity with the same key at the same point in time. On a non-temporal table this would be the primary key but for this library the actual primary key is annotated by TemporalId. For this reason Id cannot be used with UniqueKey and is used with TemporalId instead.

It is possible to annotate with UniqueKey a Embeddable class as long as the same class also uses Embedded.

It is possible to annotate the attribute with Column in order to use a different database column name. Other Column attributes should not be used.

See Also:
TemporalId