Interface CommonQueryContract
-
- All Known Subinterfaces:
MutationQuery,NativeQuery<T>,NativeQueryImplementor<R>,ProcedureCall,ProcedureCallImplementor<R>,Query<R>,QueryImplementor<R>,SelectionQuery<R>,SqmQuery,SqmQueryImplementor<R>,SqmSelectionQuery<R>
- All Known Implementing Classes:
AbstractCommonQueryContract,AbstractQuery,AbstractSelectionQuery
public interface CommonQueryContractDefines the aspects of query execution and parameter binding that apply to all forms of querying - HQL, criteria queries, andstored procedure calls.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetComment()Get the comment that has been set for this query, if any.FlushModeTypegetFlushMode()The JPAFlushModeTypein effect for this query.FlushModegetHibernateFlushMode()TheFlushModein effect for this query.IntegergetTimeout()Obtain the query timeout in seconds.CommonQueryContractsetComment(String comment)Set a comment for this query.CommonQueryContractsetFlushMode(FlushModeType flushMode)Set theFlushModein to use for this query.CommonQueryContractsetHibernateFlushMode(FlushMode flushMode)Set the currentFlushModein effect for this query.CommonQueryContractsetHint(String hintName, Object value)Apply hints to the query.CommonQueryContractsetParameter(int parameter, Object value)Bind the given argument to an ordinal query parameter.CommonQueryContractsetParameter(int parameter, Instant value, TemporalType temporalType)Bind anInstantto an ordinal query parameter using just the portion indicated by the givenTemporalType.CommonQueryContractsetParameter(int parameter, Calendar value, TemporalType temporalType)CommonQueryContractsetParameter(int parameter, Date value, TemporalType temporalType)<P> CommonQueryContractsetParameter(int parameter, P value, Class<P> type)Bind the given argument to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType.<P> CommonQueryContractsetParameter(int parameter, P value, BindableType<P> type)Bind the given argument to an ordinal query parameter using the givenBindableType.CommonQueryContractsetParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)CommonQueryContractsetParameter(Parameter<Date> param, Date value, TemporalType temporalType)<T> CommonQueryContractsetParameter(Parameter<T> param, T value)CommonQueryContractsetParameter(String parameter, Object value)Bind the given argument to a named query parameter.CommonQueryContractsetParameter(String parameter, Instant value, TemporalType temporalType)Bind anInstantto the named query parameter using just the portion indicated by the givenTemporalType.CommonQueryContractsetParameter(String parameter, Calendar value, TemporalType temporalType)CommonQueryContractsetParameter(String parameter, Date value, TemporalType temporalType)<P> CommonQueryContractsetParameter(String parameter, P value, Class<P> type)Bind the given argument to a named query parameter using the givenClassreference to attempt to infer theBindableType.<P> CommonQueryContractsetParameter(String parameter, P value, BindableType<P> type)Bind the given argument to a named query parameter using the givenBindableType.<P> CommonQueryContractsetParameter(QueryParameter<P> parameter, P value, Class<P> type)Bind an argument to the query parameter represented by the givenQueryParameter, using the givenClassreference to attempt to infer theBindableTypeto use.<P> CommonQueryContractsetParameter(QueryParameter<P> parameter, P val, BindableType<P> type)Bind an argument to the query parameter represented by the givenQueryParameter, using the givenBindableType.<T> CommonQueryContractsetParameter(QueryParameter<T> parameter, T value)Bind an argument to the query parameter represented by the givenQueryParameter.CommonQueryContractsetParameterList(int parameter, Object[] values)Bind multiple arguments to an ordinal query parameter.CommonQueryContractsetParameterList(int parameter, Collection values)Bind multiple arguments to an ordinal query parameter.<P> CommonQueryContractsetParameterList(int parameter, Collection<? extends P> values, Class<P> javaType)Bind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType.<P> CommonQueryContractsetParameterList(int parameter, Collection<? extends P> values, BindableType<P> type)Bind multiple arguments to an ordinal query parameter using the givenBindableType.<P> CommonQueryContractsetParameterList(int parameter, P[] values, Class<P> javaType)Bind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType.<P> CommonQueryContractsetParameterList(int parameter, P[] values, BindableType<P> type)Bind multiple arguments to an ordinal query parameter using the givenBindableType.CommonQueryContractsetParameterList(String parameter, Object[] values)Bind multiple arguments to a named query parameter.CommonQueryContractsetParameterList(String parameter, Collection values)Bind multiple arguments to a named query parameter.<P> CommonQueryContractsetParameterList(String parameter, Collection<? extends P> values, Class<P> javaType)Bind multiple arguments to a named query parameter using the givenClassreference to attempt to infer theBindableTypeIf unable to infer an appropriateBindableType, fall back tosetParameterList(String, Collection).<P> CommonQueryContractsetParameterList(String parameter, Collection<? extends P> values, BindableType<P> type)Bind multiple arguments to a named query parameter using the givenBindableType.<P> CommonQueryContractsetParameterList(String parameter, P[] values, Class<P> javaType)Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableTypeto use.<P> CommonQueryContractsetParameterList(String parameter, P[] values, BindableType<P> type)Bind multiple arguments to a named query parameter using the givenBindableType.<P> CommonQueryContractsetParameterList(QueryParameter<P> parameter, Collection<? extends P> values)Bind multiple arguments to the query parameter represented by the givenQueryParameter.<P> CommonQueryContractsetParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType)Bind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theBindableTypeto use.<P> CommonQueryContractsetParameterList(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> CommonQueryContractsetParameterList(QueryParameter<P> parameter, P[] values)Bind multiple arguments to the query parameter represented by the givenQueryParameter.<P> CommonQueryContractsetParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType)Bind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theBindableTypeto use.<P> CommonQueryContractsetParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type)Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theBindableType.CommonQueryContractsetProperties(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.CommonQueryContractsetProperties(Map bean)Bind the values of the givenMapto named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.CommonQueryContractsetTimeout(int timeout)Set the query timeout in seconds.
-
-
-
Method Detail
-
getFlushMode
FlushModeType getFlushMode()
The JPAFlushModeTypein effect for this query. By default, the query inherits theFlushModeof theSessionfrom which it originates.
-
setFlushMode
CommonQueryContract setFlushMode(FlushModeType flushMode)
Set theFlushModein to use for this query.- See Also:
getHibernateFlushMode(),Session.getHibernateFlushMode()- "Implementation Note:"
- Setting to
nullultimately indicates to use the FlushMode of the Session. UsesetHibernateFlushMode(org.hibernate.FlushMode)passingFlushMode.MANUALinstead to indicate that no automatic flushing should occur
-
getHibernateFlushMode
FlushMode getHibernateFlushMode()
TheFlushModein effect for this query. By default, the query inherits theFlushModeof theSessionfrom which it originates.- See Also:
Session.getHibernateFlushMode()
-
setHibernateFlushMode
CommonQueryContract setHibernateFlushMode(FlushMode flushMode)
Set the currentFlushModein effect for this query.- See Also:
getHibernateFlushMode(),Session.getHibernateFlushMode()- "Implementation Note:"
- Setting to
nullultimately indicates to use theFlushModeof the Session. UseFlushMode.MANUALinstead to indicate that no automatic flushing should occur.
-
getTimeout
Integer getTimeout()
Obtain the query timeout in seconds.This value is eventually passed along to the JDBC statement via
Statement.setQueryTimeout(int).A value of zero indicates no timeout.
-
setTimeout
CommonQueryContract setTimeout(int timeout)
Set the query timeout in seconds.Any value set here is eventually passed directly along to the JDBC statement, which expressly disallows negative values. So negative values should be avoided as a general rule.
A value of zero indicates no timeout.
- Parameters:
timeout- the timeout in seconds- Returns:
this, for method chaining- See Also:
getTimeout()
-
getComment
String getComment()
Get the comment that has been set for this query, if any.
-
setComment
CommonQueryContract setComment(String comment)
Set a comment for this query.- See Also:
Query.setComment(String)
-
setHint
CommonQueryContract setHint(String hintName, Object value)
Apply hints to the query.
-
setParameter
CommonQueryContract setParameter(String parameter, Object value)
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".
-
setParameter
<P> CommonQueryContract setParameter(String parameter, P value, Class<P> type)
Bind the given argument to a named query parameter using the givenClassreference to attempt to infer theBindableType. If unable to infer an appropriateBindableType, fall back tosetParameter(String, Object).
-
setParameter
<P> CommonQueryContract setParameter(String parameter, P value, BindableType<P> type)
Bind the given argument to a named query parameter using the givenBindableType.
-
setParameter
CommonQueryContract setParameter(String parameter, Instant value, TemporalType temporalType)
Bind anInstantto the named query parameter using just the portion indicated by the givenTemporalType.
-
setParameter
CommonQueryContract setParameter(String parameter, Calendar value, TemporalType temporalType)
-
setParameter
CommonQueryContract setParameter(String parameter, Date value, TemporalType temporalType)
-
setParameter
CommonQueryContract setParameter(int parameter, Object value)
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".
-
setParameter
<P> CommonQueryContract setParameter(int parameter, P value, Class<P> type)
Bind the given argument to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType. If unable to infer an appropriateBindableType, fall back tosetParameter(int, Object).
-
setParameter
<P> CommonQueryContract setParameter(int parameter, P value, BindableType<P> type)
Bind the given argument to an ordinal query parameter using the givenBindableType.
-
setParameter
CommonQueryContract setParameter(int parameter, Instant value, TemporalType temporalType)
Bind anInstantto an ordinal query parameter using just the portion indicated by the givenTemporalType.
-
setParameter
CommonQueryContract setParameter(int parameter, Date value, TemporalType temporalType)
-
setParameter
CommonQueryContract setParameter(int parameter, Calendar value, TemporalType temporalType)
-
setParameter
<T> CommonQueryContract setParameter(QueryParameter<T> parameter, T value)
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".
- Parameters:
parameter- the query parameter mementovalue- the argument, which might be null- Returns:
this, for method chaining- See Also:
setParameter(QueryParameter, Object, BindableType)
-
setParameter
<P> CommonQueryContract setParameter(QueryParameter<P> parameter, P value, Class<P> type)
Bind an argument to the query parameter represented by the givenQueryParameter, using the givenClassreference to attempt to infer theBindableTypeto use. If unable to infer an appropriateBindableType, fall back tosetParameter(QueryParameter, Object).- Parameters:
parameter- the query parameter mementovalue- the argument, which might be nulltype- aBindableTyperepresenting the type of the parameter- Returns:
this, for method chaining- See Also:
BindableType.parameterType(Class),setParameter(QueryParameter, Object, BindableType)
-
setParameter
<P> CommonQueryContract setParameter(QueryParameter<P> parameter, P val, BindableType<P> type)
Bind an argument to the query parameter represented by the givenQueryParameter, using the givenBindableType.- Parameters:
parameter- the query parameter mementoval- the argument, which might be nulltype- aBindableTyperepresenting the type of the parameter- Returns:
this, for method chaining
-
setParameter
<T> CommonQueryContract setParameter(Parameter<T> param, T value)
- See Also:
Query.setParameter(Parameter, Object)
-
setParameter
CommonQueryContract setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
-
setParameter
CommonQueryContract setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
-
setParameterList
CommonQueryContract setParameterList(String parameter, Collection values)
Bind multiple arguments to a named query parameter. The "type mapping" for the binding is inferred from the type of the first collection element.- Returns:
this, for method chaining- See Also:
setParameterList(java.lang.String, java.util.Collection, BindableType)- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(String parameter, Collection<? extends P> values, Class<P> javaType)
Bind multiple arguments to a named query parameter using the givenClassreference to attempt to infer theBindableTypeIf unable to infer an appropriateBindableType, fall back tosetParameterList(String, Collection).- Returns:
this, for method chaining- See Also:
BindableType.parameterType(Class),setParameterList(java.lang.String, java.util.Collection, BindableType)- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(String parameter, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to a named query parameter using the givenBindableType.- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
CommonQueryContract setParameterList(String parameter, Object[] values)
Bind multiple arguments to a named query parameter. The "type mapping" for the binding is inferred from the type of the first collection element- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(String parameter, P[] values, Class<P> javaType)
Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableTypeto use. If unable to determine an appropriateBindableType,setParameterList(String, Collection)is used- Returns:
this, for method chaining- See Also:
BindableType.parameterType(Class),setParameterList(java.lang.String, Object[], BindableType)- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(String parameter, P[] values, BindableType<P> type)
Bind multiple arguments to a named query parameter using the givenBindableType.- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
CommonQueryContract setParameterList(int parameter, Collection values)
Bind multiple arguments to an ordinal query parameter. The "type mapping" for the binding is inferred from the type of the first collection element- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(int parameter, Collection<? extends P> values, Class<P> javaType)
Bind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType. If unable to infer an appropriateBindableType, fall back tosetParameterList(String, Collection).- Returns:
this, for method chaining- See Also:
BindableType.parameterType(Class),setParameterList(int, Collection, BindableType)- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(int parameter, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to an ordinal query parameter using the givenBindableType.- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
CommonQueryContract setParameterList(int parameter, Object[] values)
Bind multiple arguments to an ordinal query parameter. The "type mapping" for the binding is inferred from the type of the first collection element- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(int parameter, P[] values, Class<P> javaType)
Bind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType. If unable to infer an appropriateBindableType, fall back tosetParameterList(String, Collection).- Returns:
this, for method chaining- See Also:
BindableType.parameterType(Class),setParameterList(int, Object[], BindableType)- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(int parameter, P[] values, BindableType<P> type)
Bind multiple arguments to an ordinal query parameter using the givenBindableType.- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(QueryParameter<P> parameter, Collection<? extends P> values)
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.
- Parameters:
parameter- the parameter mementovalues- a collection of arguments- Returns:
this, for method chaining
-
setParameterList
<P> CommonQueryContract setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType)
Bind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theBindableTypeto use. If unable to infer an appropriateBindableType, fall back to usingsetParameterList(String, Collection).- Returns:
this, for method chaining- See Also:
BindableType.parameterType(Class),setParameterList(QueryParameter, java.util.Collection, BindableType)- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract 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.- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(QueryParameter<P> parameter, P[] values)
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
QueryParameterand the type of the first given argument.- Parameters:
parameter- the parameter mementovalues- a collection of arguments- Returns:
this, for method chaining
-
setParameterList
<P> CommonQueryContract setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType)
Bind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theBindableTypeto use. If unable to infer an appropriateBindableType, fall back to usingsetParameterList(String, Collection).- Returns:
this, for method chaining- See Also:
BindableType.parameterType(Class),setParameterList(QueryParameter, Object[], BindableType)- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setParameterList
<P> CommonQueryContract setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type)
Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theBindableType.- Returns:
this, for method chaining- "API Note:"
- This is used for binding a list of values to an expression
such as
entity.field in (:values).
-
setProperties
CommonQueryContract 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.- Parameters:
bean- any JavaBean or POJO- Returns:
this, for method chaining
-
setProperties
CommonQueryContract setProperties(Map bean)
Bind the values of the givenMapto named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.- Parameters:
bean- aMapof names to arguments- Returns:
this, for method chaining
-
-