Package io.objectbox.annotation
Annotation Interface Unique
Enforces that the value of a property is unique among all objects in a box before an object can be put.
Trying to put an object with offending values will result in a UniqueViolationException (see ConflictStrategy.FAIL).
Set onConflict() to change this strategy.
Note: Unique properties are based on an @Index, so the same restrictions apply.
It is supported to explicitly add the @Index annotation to configure the index.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe strategy to use when a conflict is detected when an object is put.
-
Element Details
-
onConflict
ConflictStrategy onConflictThe strategy to use when a conflict is detected when an object is put.- Default:
- FAIL
-