Annotation Interface Upsert
Lifecycle annotation for repository methods which perform upsert operations.
The Upsert annotation indicates that the annotated repository method adds the state of one or more
entities to the database when missing, or updates the existing database state when present.
An Upsert method accepts an instance or instances of an entity class. The method must have exactly one
parameter whose type is either:
- the class of the entity to be upserted, or
Iterable<E>whereEis the class of the entities to be upserted.
The annotated method may be declared void, return a number type, return the entity type, or return an
iterable/reactive/asynchronous container producing the entity type, depending on the repository type.
By default, the entity identity is used to determine whether an existing row should be updated. The
conflictsOn() member can be used to select a different property or set of properties as the conflict
target.
- Since:
- 5.2.0
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]The persistent entity properties to use as the conflict target.
-
Element Details
-
conflictsOn
String[] conflictsOnThe persistent entity properties to use as the conflict target.- Returns:
- The conflict target properties
- Default:
{}
-