Package org.hibernate.query.criteria
Interface JpaConflictClause<T>
-
- All Known Implementing Classes:
SqmConflictClause
@Incubating public interface JpaConflictClause<T>
A conflict clause for insert statements.- Since:
- 6.5
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description JpaConflictClause<T>conflictOnConstraint(@Nullable String constraintName)Sets the unique constraint name for which a constraint violation is allowed.JpaConflictClause<T>conflictOnConstraintAttributes(SingularAttribute<T,?>... attributes)Shorthand for callingconflictOnConstraintPaths(List)with paths resolved for the given attributes against the insert target.JpaConflictClause<T>conflictOnConstraintAttributes(String... attributes)Shorthand for callingconflictOnConstraintPaths(List)with paths resolved for the given attributes against the insert target.JpaConflictClause<T>conflictOnConstraintPaths(Path<?>... paths)JpaConflictClause<T>conflictOnConstraintPaths(List<? extends Path<?>> paths)Sets the paths which are part of a unique constraint, for which a constraint violation is allowed.JpaConflictUpdateAction<T>createConflictUpdateAction()Create a new conflict update action for this insert statement.@Nullable JpaConflictUpdateAction<T>getConflictAction()The action to do when a conflict due to a unique constraint violation happens.@Nullable StringgetConstraintName()The unique constraint name for which a constraint violation is allowed.List<? extends JpaPath<?>>getConstraintPaths()The paths which are part of a unique constraint, for which a constraint violation is allowed.JpaRoot<T>getExcludedRoot()The excluded row/object which was not inserted.JpaConflictClause<T>onConflictDo(@Nullable JpaConflictUpdateAction<T> action)Sets the action to do on a conflict.default JpaConflictClause<T>onConflictDoNothing()Shorthand version for callingonConflictDo(JpaConflictUpdateAction)with anullargument.default JpaConflictUpdateAction<T>onConflictDoUpdate()Shorthand version for callingonConflictDo(JpaConflictUpdateAction)withcreateConflictUpdateAction()as argument and returning the update action.
-
-
-
Method Detail
-
getConstraintName
@Nullable String getConstraintName()
The unique constraint name for which a constraint violation is allowed.
-
conflictOnConstraint
JpaConflictClause<T> conflictOnConstraint(@Nullable String constraintName)
Sets the unique constraint name for which a constraint violation is allowed.- Throws:
IllegalStateException- when constraint paths have already been defined
-
getConstraintPaths
List<? extends JpaPath<?>> getConstraintPaths()
The paths which are part of a unique constraint, for which a constraint violation is allowed.
-
conflictOnConstraintAttributes
JpaConflictClause<T> conflictOnConstraintAttributes(String... attributes)
Shorthand for callingconflictOnConstraintPaths(List)with paths resolved for the given attributes against the insert target.
-
conflictOnConstraintAttributes
JpaConflictClause<T> conflictOnConstraintAttributes(SingularAttribute<T,?>... attributes)
Shorthand for callingconflictOnConstraintPaths(List)with paths resolved for the given attributes against the insert target.
-
conflictOnConstraintPaths
JpaConflictClause<T> conflictOnConstraintPaths(Path<?>... paths)
-
conflictOnConstraintPaths
JpaConflictClause<T> conflictOnConstraintPaths(List<? extends Path<?>> paths)
Sets the paths which are part of a unique constraint, for which a constraint violation is allowed.- Throws:
IllegalStateException- when a constraint name has already been defined
-
getConflictAction
@Nullable JpaConflictUpdateAction<T> getConflictAction()
The action to do when a conflict due to a unique constraint violation happens.
-
onConflictDo
JpaConflictClause<T> onConflictDo(@Nullable JpaConflictUpdateAction<T> action)
Sets the action to do on a conflict. Settingnullmeans to do nothing.- See Also:
createConflictUpdateAction()
-
onConflictDoUpdate
default JpaConflictUpdateAction<T> onConflictDoUpdate()
Shorthand version for callingonConflictDo(JpaConflictUpdateAction)withcreateConflictUpdateAction()as argument and returning the update action.
-
onConflictDoNothing
default JpaConflictClause<T> onConflictDoNothing()
Shorthand version for callingonConflictDo(JpaConflictUpdateAction)with anullargument.
-
createConflictUpdateAction
JpaConflictUpdateAction<T> createConflictUpdateAction()
Create a new conflict update action for this insert statement.- Returns:
- a new conflict update action
- See Also:
onConflictDo(JpaConflictUpdateAction)
-
-