Interface MutationQuery
-
- All Superinterfaces:
CommonQueryContract
- All Known Subinterfaces:
NativeQuery<T>
,NativeQueryImplementor<R>
,ProcedureCallImplementor<R>
,Query<R>
,QueryImplementor<R>
,SqmQueryImplementor<R>
- All Known Implementing Classes:
AbstractQuery
,NativeQueryImpl
,ProcedureCallImpl
,QuerySqmImpl
public interface MutationQuery extends CommonQueryContract
Models a mutation (insert, update, or delete) query. It is a slimmed down version ofQuery
, but providing only methods relevant to mutation queries.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
executeUpdate()
Execute an insert, update, or delete statement, and return the number of affected entities.MutationQuery
setHibernateFlushMode(FlushMode flushMode)
Set the currentFlushMode
in effect for this query.MutationQuery
setParameter(int position, Object value)
Bind the given argument to an ordinal query parameter.MutationQuery
setParameter(int position, Instant value, jakarta.persistence.TemporalType temporalType)
Bind anInstant
to an ordinal query parameter using just the portion indicated by the givenTemporalType
.MutationQuery
setParameter(int position, Calendar value, jakarta.persistence.TemporalType temporalType)
MutationQuery
setParameter(int position, Date value, jakarta.persistence.TemporalType temporalType)
<P> MutationQuery
setParameter(int position, P value, Class<P> type)
Bind the given argument to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
.<P> MutationQuery
setParameter(int position, P value, BindableType<P> type)
Bind the given argument to an ordinal query parameter using the givenBindableType
.MutationQuery
setParameter(jakarta.persistence.Parameter<Calendar> param, Calendar value, jakarta.persistence.TemporalType temporalType)
MutationQuery
setParameter(jakarta.persistence.Parameter<Date> param, Date value, jakarta.persistence.TemporalType temporalType)
<T> MutationQuery
setParameter(jakarta.persistence.Parameter<T> param, T value)
MutationQuery
setParameter(String name, Object value)
Bind the given argument to a named query parameter.MutationQuery
setParameter(String name, Instant value, jakarta.persistence.TemporalType temporalType)
Bind anInstant
to the named query parameter using just the portion indicated by the givenTemporalType
.MutationQuery
setParameter(String name, Calendar value, jakarta.persistence.TemporalType temporalType)
MutationQuery
setParameter(String name, Date value, jakarta.persistence.TemporalType temporalType)
<P> MutationQuery
setParameter(String name, P value, Class<P> type)
Bind the given argument to a named query parameter using the givenClass
reference to attempt to infer theBindableType
.<P> MutationQuery
setParameter(String name, P value, BindableType<P> type)
Bind the given argument to a named query parameter using the givenBindableType
.<P> MutationQuery
setParameter(QueryParameter<P> parameter, P value, Class<P> type)
Bind an argument to the query parameter represented by the givenQueryParameter
, using the givenClass
reference to attempt to infer theBindableType
to use.<P> MutationQuery
setParameter(QueryParameter<P> parameter, P val, BindableType<P> type)
Bind an argument to the query parameter represented by the givenQueryParameter
, using the givenBindableType
.<T> MutationQuery
setParameter(QueryParameter<T> parameter, T value)
Bind an argument to the query parameter represented by the givenQueryParameter
.MutationQuery
setParameterList(int position, Object[] values)
Bind multiple arguments to an ordinal query parameter.MutationQuery
setParameterList(int position, Collection values)
Bind multiple arguments to an ordinal query parameter.<P> MutationQuery
setParameterList(int position, Collection<? extends P> values, Class<P> javaType)
Bind multiple arguments to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
.<P> MutationQuery
setParameterList(int position, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.<P> MutationQuery
setParameterList(int position, P[] values, Class<P> javaType)
Bind multiple arguments to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
.<P> MutationQuery
setParameterList(int position, P[] values, BindableType<P> type)
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.MutationQuery
setParameterList(String name, Object[] values)
Bind multiple arguments to a named query parameter.MutationQuery
setParameterList(String name, Collection values)
Bind multiple arguments to a named query parameter.<P> MutationQuery
setParameterList(String name, Collection<? extends P> values, Class<P> javaType)
Bind multiple arguments to a named query parameter using the givenClass
reference to attempt to infer theBindableType
If unable to infer an appropriateBindableType
, fall back toCommonQueryContract.setParameterList(String, Collection)
.<P> MutationQuery
setParameterList(String name, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to a named query parameter using the givenBindableType
.<P> MutationQuery
setParameterList(String name, P[] values, Class<P> javaType)
Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableType
to use.<P> MutationQuery
setParameterList(String name, P[] values, BindableType<P> type)
Bind multiple arguments to a named query parameter using the givenBindableType
.<P> MutationQuery
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.<P> MutationQuery
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the givenClass
reference to attempt to infer theBindableType
to use.<P> MutationQuery
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, using the givenBindableType
.<P> MutationQuery
setParameterList(QueryParameter<P> parameter, P[] values)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.<P> MutationQuery
setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the givenClass
reference to attempt to infer theBindableType
to use.<P> MutationQuery
setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, using the given theBindableType
.MutationQuery
setProperties(Object bean)
Bind the property values of the given bean to named parameters of the query, matching property names with parameter names and mapping property types to Hibernate types using heuristics.MutationQuery
setProperties(Map bean)
Bind the values of the givenMap
to named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.-
Methods inherited from interface org.hibernate.query.CommonQueryContract
getComment, getFlushMode, getHibernateFlushMode, getTimeout, setComment, setFlushMode, setHint, setTimeout
-
-
-
-
Method Detail
-
executeUpdate
int executeUpdate()
Execute an insert, update, or delete statement, and return the number of affected entities.For use with instances of
MutationQuery
created usingQueryProducer.createMutationQuery(String)
,QueryProducer.createNamedMutationQuery(String)
,QueryProducer.createNativeMutationQuery(String)
,QueryProducer.createQuery(jakarta.persistence.criteria.CriteriaUpdate)
, orQueryProducer.createQuery(jakarta.persistence.criteria.CriteriaDelete)
.- Returns:
- the number of affected entity instances (may differ from the number of affected rows)
- See Also:
QueryProducer.createMutationQuery(String)
,QueryProducer.createNamedMutationQuery(String)
,QueryProducer.createNativeMutationQuery(String)
,Query.executeUpdate()
-
setParameter
MutationQuery setParameter(String name, Object value)
Description copied from interface:CommonQueryContract
Bind the given argument to a named query parameter.If the type of the parameter cannot be inferred from the context in which it occurs, use one of the forms which accepts a "type".
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
CommonQueryContract.setParameter(String, Object, Class)
,CommonQueryContract.setParameter(String, Object, BindableType)
-
setParameter
<P> MutationQuery setParameter(String name, P value, Class<P> type)
Description copied from interface:CommonQueryContract
Bind the given argument to a named query parameter using the givenClass
reference to attempt to infer theBindableType
. If unable to infer an appropriateBindableType
, fall back toCommonQueryContract.setParameter(String, Object)
.- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
CommonQueryContract.setParameter(String, Object, BindableType)
-
setParameter
<P> MutationQuery setParameter(String name, P value, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind the given argument to a named query parameter using the givenBindableType
.- Specified by:
setParameter
in interfaceCommonQueryContract
-
setParameter
MutationQuery setParameter(String name, Instant value, jakarta.persistence.TemporalType temporalType)
Description copied from interface:CommonQueryContract
Bind anInstant
to the named query parameter using just the portion indicated by the givenTemporalType
.- Specified by:
setParameter
in interfaceCommonQueryContract
-
setParameter
MutationQuery setParameter(String name, Calendar value, jakarta.persistence.TemporalType temporalType)
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
Query.setParameter(String, Calendar, TemporalType)
-
setParameter
MutationQuery setParameter(String name, Date value, jakarta.persistence.TemporalType temporalType)
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
Query.setParameter(String, Date, TemporalType)
-
setParameter
MutationQuery setParameter(int position, Object value)
Description copied from interface:CommonQueryContract
Bind the given argument to an ordinal query parameter.If the type of the parameter cannot be inferred from the context in which it occurs, use one of the forms which accepts a "type".
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
CommonQueryContract.setParameter(int, Object, Class)
,CommonQueryContract.setParameter(int, Object, BindableType)
-
setParameter
<P> MutationQuery setParameter(int position, P value, Class<P> type)
Description copied from interface:CommonQueryContract
Bind the given argument to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
. If unable to infer an appropriateBindableType
, fall back toCommonQueryContract.setParameter(int, Object)
.- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
CommonQueryContract.setParameter(int, Object, BindableType)
-
setParameter
<P> MutationQuery setParameter(int position, P value, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind the given argument to an ordinal query parameter using the givenBindableType
.- Specified by:
setParameter
in interfaceCommonQueryContract
-
setParameter
MutationQuery setParameter(int position, Instant value, jakarta.persistence.TemporalType temporalType)
Description copied from interface:CommonQueryContract
Bind anInstant
to an ordinal query parameter using just the portion indicated by the givenTemporalType
.- Specified by:
setParameter
in interfaceCommonQueryContract
-
setParameter
MutationQuery setParameter(int position, Date value, jakarta.persistence.TemporalType temporalType)
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
Query.setParameter(int, Date, TemporalType)
-
setParameter
MutationQuery setParameter(int position, Calendar value, jakarta.persistence.TemporalType temporalType)
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
Query.setParameter(int, Calendar, TemporalType)
-
setParameter
<T> MutationQuery setParameter(QueryParameter<T> parameter, T value)
Description copied from interface:CommonQueryContract
Bind an argument to the query parameter represented by the givenQueryParameter
.If the type of the parameter cannot be inferred from the context in which it occurs, use one of the forms which accepts a "type".
- Specified by:
setParameter
in interfaceCommonQueryContract
- Parameters:
parameter
- the query parameter mementovalue
- the argument, which might be null- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameter(QueryParameter, Object, BindableType)
-
setParameter
<P> MutationQuery setParameter(QueryParameter<P> parameter, P value, Class<P> type)
Description copied from interface:CommonQueryContract
Bind an argument to the query parameter represented by the givenQueryParameter
, using the givenClass
reference to attempt to infer theBindableType
to use. If unable to infer an appropriateBindableType
, fall back toCommonQueryContract.setParameter(QueryParameter, Object)
.- Specified by:
setParameter
in interfaceCommonQueryContract
- Parameters:
parameter
- the query parameter mementovalue
- the argument, which might be nulltype
- aBindableType
representing the type of the parameter- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameter(QueryParameter, Object, BindableType)
-
setParameter
<P> MutationQuery setParameter(QueryParameter<P> parameter, P val, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind an argument to the query parameter represented by the givenQueryParameter
, using the givenBindableType
.- Specified by:
setParameter
in interfaceCommonQueryContract
- Parameters:
parameter
- the query parameter mementoval
- the argument, which might be nulltype
- aBindableType
representing the type of the parameter- Returns:
this
, for method chaining
-
setParameter
<T> MutationQuery setParameter(jakarta.persistence.Parameter<T> param, T value)
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
Query.setParameter(Parameter, Object)
-
setParameter
MutationQuery setParameter(jakarta.persistence.Parameter<Calendar> param, Calendar value, jakarta.persistence.TemporalType temporalType)
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
Query.setParameter(Parameter, Calendar, TemporalType)
-
setParameter
MutationQuery setParameter(jakarta.persistence.Parameter<Date> param, Date value, jakarta.persistence.TemporalType temporalType)
- Specified by:
setParameter
in interfaceCommonQueryContract
- See Also:
Query.setParameter(Parameter, Date, TemporalType)
-
setParameterList
MutationQuery setParameterList(String name, Collection values)
Description copied from interface:CommonQueryContract
Bind multiple arguments to a named query parameter.The "type mapping" for the binding is inferred from the type of the first collection element.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(java.lang.String, java.util.Collection, BindableType)
-
setParameterList
<P> MutationQuery setParameterList(String name, Collection<? extends P> values, Class<P> javaType)
Description copied from interface:CommonQueryContract
Bind multiple arguments to a named query parameter using the givenClass
reference to attempt to infer theBindableType
If unable to infer an appropriateBindableType
, fall back toCommonQueryContract.setParameterList(String, Collection)
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(java.lang.String, java.util.Collection, BindableType)
-
setParameterList
<P> MutationQuery setParameterList(String name, Collection<? extends P> values, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind multiple arguments to a named query parameter using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setParameterList
MutationQuery setParameterList(String name, Object[] values)
Description copied from interface:CommonQueryContract
Bind multiple arguments to a named query parameter.The "type mapping" for the binding is inferred from the type of the first collection element
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setParameterList
<P> MutationQuery setParameterList(String name, P[] values, Class<P> javaType)
Description copied from interface:CommonQueryContract
Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,CommonQueryContract.setParameterList(String, Collection)
is used- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(java.lang.String, Object[], BindableType)
-
setParameterList
<P> MutationQuery setParameterList(String name, P[] values, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind multiple arguments to a named query parameter using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setParameterList
MutationQuery setParameterList(int position, Collection values)
Description copied from interface:CommonQueryContract
Bind multiple arguments to an ordinal query parameter.The "type mapping" for the binding is inferred from the type of the first collection element
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setParameterList
<P> MutationQuery setParameterList(int position, Collection<? extends P> values, Class<P> javaType)
Description copied from interface:CommonQueryContract
Bind multiple arguments to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
. If unable to infer an appropriateBindableType
, fall back toCommonQueryContract.setParameterList(String, Collection)
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(int, Collection, BindableType)
-
setParameterList
<P> MutationQuery setParameterList(int position, Collection<? extends P> values, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setParameterList
MutationQuery setParameterList(int position, Object[] values)
Description copied from interface:CommonQueryContract
Bind multiple arguments to an ordinal query parameter.The "type mapping" for the binding is inferred from the type of the first collection element
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setParameterList
<P> MutationQuery setParameterList(int position, P[] values, Class<P> javaType)
Description copied from interface:CommonQueryContract
Bind multiple arguments to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
. If unable to infer an appropriateBindableType
, fall back toCommonQueryContract.setParameterList(String, Collection)
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(int, Object[], BindableType)
-
setParameterList
<P> MutationQuery setParameterList(int position, P[] values, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setParameterList
<P> MutationQuery setParameterList(QueryParameter<P> parameter, Collection<? extends P> values)
Description copied from interface:CommonQueryContract
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.The type of the parameter is inferred from the context in which it occurs, and from the type of the first given argument.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Parameters:
parameter
- the parameter mementovalues
- a collection of arguments- Returns:
this
, for method chaining
-
setParameterList
<P> MutationQuery setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType)
Description copied from interface:CommonQueryContract
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the givenClass
reference to attempt to infer theBindableType
to use. If unable to infer an appropriateBindableType
, fall back to usingCommonQueryContract.setParameterList(String, Collection)
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(QueryParameter, java.util.Collection, BindableType)
-
setParameterList
<P> MutationQuery setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setParameterList
<P> MutationQuery setParameterList(QueryParameter<P> parameter, P[] values)
Description copied from interface:CommonQueryContract
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.The type of the parameter is inferred between the context in which it occurs, the type associated with the
QueryParameter
and the type of the first given argument.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Parameters:
parameter
- the parameter mementovalues
- a collection of arguments- Returns:
this
, for method chaining
-
setParameterList
<P> MutationQuery setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType)
Description copied from interface:CommonQueryContract
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the givenClass
reference to attempt to infer theBindableType
to use. If unable to infer an appropriateBindableType
, fall back to usingCommonQueryContract.setParameterList(String, Collection)
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(QueryParameter, Object[], BindableType)
-
setParameterList
<P> MutationQuery setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type)
Description copied from interface:CommonQueryContract
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, using the given theBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Returns:
this
, for method chaining
-
setProperties
MutationQuery setProperties(Object bean)
Description copied from interface:CommonQueryContract
Bind the property values of the given bean to named parameters of the query, matching property names with parameter names and mapping property types to Hibernate types using heuristics.- Specified by:
setProperties
in interfaceCommonQueryContract
- Parameters:
bean
- any JavaBean or POJO- Returns:
this
, for method chaining
-
setProperties
MutationQuery setProperties(Map bean)
Description copied from interface:CommonQueryContract
Bind the values of the givenMap
to named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.- Specified by:
setProperties
in interfaceCommonQueryContract
- Parameters:
bean
- aMap
of names to arguments- Returns:
this
, for method chaining
-
setHibernateFlushMode
MutationQuery setHibernateFlushMode(FlushMode flushMode)
Description copied from interface:CommonQueryContract
Set the currentFlushMode
in effect for this query.- Specified by:
setHibernateFlushMode
in interfaceCommonQueryContract
- See Also:
CommonQueryContract.getHibernateFlushMode()
,Session.getHibernateFlushMode()
-
-