Interface UpdateSpecification<T>
- Type Parameters:
T- The entity type which is the target of the mutation.
- All Superinterfaces:
MutationSpecification<T>, QuerySpecification<T>
Specialization of
MutationSpecification for programmatic customization
of update queries.
The method assign(Assignment) allows application of additional
assignments to the mutated entity. The static factory
methods of Assignment are used to express assignments to attributes
or compound paths.
UpdateSpecification.create(Book.class)
.assign(Assignment.set(Book_.title, newTitle))
.restrict(Restriction.equal(Book_.isbn, isbn))
.createQuery(session)
.executeUpdate();
- Since:
- 7.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface MutationSpecification
MutationSpecification.Augmentation<T> -
Method Summary
Modifier and TypeMethodDescriptionassign(Assignment<? super T> assignment) Add an assigment to a field or property of the target entity.augment(MutationSpecification.Augmentation<T> augmentation) Add an augmentation to the specification.static <T> UpdateSpecification<T> create(CriteriaUpdate<T> criteriaUpdate) Returns a specification reference which can be used to programmatically, iteratively build a MutationQuery based on the given criteria update, allowing the addition of restrictions and assignments.static <T> UpdateSpecification<T> Returns a specification reference which can be used to programmatically, iteratively build a MutationQuery which updates the given entity type.reassign(List<? extends Assignment<? super T>> assignments) Sets the assignments to fields or properties of the target entity.restrict(Restriction<? super T> restriction) Adds a restriction to the query specification.validate(CriteriaBuilder builder) Validate the query.Methods inherited from interface MutationSpecification
createQuery, createQuery, referenceMethods inherited from interface QuerySpecification
buildCriteria, createQuery
-
Method Details
-
assign
Add an assigment to a field or property of the target entity.- Parameters:
assignment- The assignment to add- Returns:
thisfor method chaining.
-
reassign
Sets the assignments to fields or properties of the target entity. If assignments were already specified, this method drops the previous assignments in favor of the passedassignments.- Parameters:
assignments- The new assignments- Returns:
thisfor method chaining.
-
restrict
Description copied from interface:QuerySpecificationAdds a restriction to the query specification.- Specified by:
restrictin interfaceMutationSpecification<T>- Specified by:
restrictin interfaceQuerySpecification<T>- Parameters:
restriction- The restriction predicate to be added.- Returns:
thisfor method chaining.
-
augment
Description copied from interface:MutationSpecificationAdd an augmentation to the specification.- Specified by:
augmentin interfaceMutationSpecification<T>- Parameters:
augmentation- A function capable of modifying or augmenting a criteria query.- Returns:
thisfor method chaining.
-
validate
Description copied from interface:QuerySpecificationValidate the query.- Specified by:
validatein interfaceMutationSpecification<T>- Specified by:
validatein interfaceQuerySpecification<T>- Returns:
thisif everything is fine
-
create
Returns a specification reference which can be used to programmatically, iteratively build a MutationQuery which updates the given entity type.- Type Parameters:
T- The root entity type for the mutation (the "target").- Parameters:
targetEntityClass- The target entity type
-
create
Returns a specification reference which can be used to programmatically, iteratively build a MutationQuery based on the given criteria update, allowing the addition of restrictions and assignments.- Type Parameters:
T- The root entity type for the mutation (the "target").- Parameters:
criteriaUpdate- The criteria update query
-