Interface UpdateSpecification.UpdateOperation<T>
- Type Parameters:
T
-
- Enclosing interface:
- UpdateSpecification<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Simplified extension to
UpdateSpecification
that only considers the UPDATE
part without specifying
a predicate. This is useful to separate concerns for reusable specifications, for example:
UpdateSpecification<User> updateLastname = UpdateSpecification .<User> update((root, update, criteriaBuilder) -> update.set("lastname", "Heisenberg")) .where(userHasFirstname("Walter").and(userHasLastname("White"))); repository.update(updateLastname);
-
Method Summary
Modifier and TypeMethodDescriptiondefault UpdateSpecification.UpdateOperation<T>
and
(UpdateSpecification.UpdateOperation<T> other) ANDs the givenUpdateSpecification.UpdateOperation
to the current one.void
apply
(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaUpdate<T> update, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Accept the givenRoot
andCriteriaUpdate
to apply the update operation.default UpdateSpecification<T>
where
(PredicateSpecification<T> specification) Creates aUpdateSpecification
from this and the givenUpdateSpecification
.default UpdateSpecification<T>
where
(UpdateSpecification<T> specification) Creates aUpdateSpecification
from this and the givenUpdateSpecification
.
-
Method Details
-
and
@Contract("_ -> new") @CheckReturnValue default UpdateSpecification.UpdateOperation<T> and(UpdateSpecification.UpdateOperation<T> other) ANDs the givenUpdateSpecification.UpdateOperation
to the current one.- Parameters:
other
- the otherUpdateSpecification.UpdateOperation
.- Returns:
- the conjunction of the specifications.
-
where
@Contract("_ -> new") @CheckReturnValue default UpdateSpecification<T> where(PredicateSpecification<T> specification) Creates aUpdateSpecification
from this and the givenUpdateSpecification
.- Parameters:
specification
- thePredicateSpecification
.- Returns:
- the conjunction of the specifications.
-
where
@Contract("_ -> new") @CheckReturnValue default UpdateSpecification<T> where(UpdateSpecification<T> specification) Creates aUpdateSpecification
from this and the givenUpdateSpecification
.- Parameters:
specification
- theUpdateSpecification
.- Returns:
- the conjunction of the specifications.
-
apply
void apply(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaUpdate<T> update, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Accept the givenRoot
andCriteriaUpdate
to apply the update operation.- Parameters:
root
- must not be null.update
- the update criteria.criteriaBuilder
- must not be null.
-