Class AbstractCommonQueryContract
- All Implemented Interfaces:
CommonQueryContract
- Direct Known Subclasses:
AbstractSelectionQuery
- Author:
- Steve Ebersole
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanapplyAdditionalPossibleHints(String hintName, Object value) protected voidapplyAliasSpecificLockModeHint(String hintName, Object value) protected voidapplyCacheableHint(boolean isCacheable) protected voidapplyCacheModeHint(CacheMode cacheMode) protected voidapplyCacheRegionHint(String regionName) protected voidapplyCommentHint(String comment) protected voidapplyDatabaseHint(String hint) protected voidapplyEntityGraphHint(String hintName, Object value) protected voidapplyFetchSizeHint(int fetchSize) voidapplyFirstResult(int startPosition) protected voidapplyFlushModeHint(FlushMode flushMode) protected voidapplyFollowOnLockingHint(Boolean followOnLocking) protected voidapplyGraph(String graphString, GraphSemantic graphSemantic) protected voidapplyGraph(RootGraphImplementor<?> entityGraph, GraphSemantic graphSemantic) protected voidapplyHibernateLockMode(LockMode value) final booleanprotected booleanapplyJpaCacheRetrieveModeHint(CacheRetrieveMode retrieveMode) protected booleanapplyJpaCacheStoreModeHint(CacheStoreMode storeMode) protected voidapplyJpaFlushMode(FlushModeType flushModeType) protected final voidapplyLockModeHint(Object value) protected voidapplyLockModeType(LockModeType value) protected voidapplyLockTimeoutHint(int timeout) protected voidapplyLockTimeoutHint(Integer timeout) voidapplyMaxResults(int maxResult) protected voidapplyQueryPlanCacheableHint(boolean isCacheable) booleanapplyResultListTransformer(ResultListTransformer<?> transformer) protected final booleanapplySelectionHint(String hintName, Object value) protected voidapplySynchronizeSpacesHint(Object value) protected voidapplyTimeoutHint(int timeout) booleanapplyTupleTransformer(TupleTransformer<?> transformer) protected voidcollectHints(Map<String, Object> hints) protected BindableType<Object>determineType(String namedParam, Class<?> retType) Get the comment that has been set for this query, if any.intTheFlushModein effect for this query.getHints()protected intgetIntegerLiteral(JpaExpression<Number> expression, int defaultValue) protected FlushModeTypeintprotected intgetMaxRows(SqmSelectStatement<?> selectStatement, int size) getParameter(int position) <T> QueryParameterImplementor<T>getParameter(int position, Class<T> type) getParameter(String name) <T> QueryParameterImplementor<T>getParameter(String name, Class<T> type) protected abstract ParameterMetadataImplementorgetParameterValue(int position) <T> TgetParameterValue(Parameter<T> param) getParameterValue(String name) protected abstract QueryParameterBindingsObtain the query timeout in seconds.booleanprotected <P> QueryParameterBinding<P>locateBinding(int position) protected <P> QueryParameterBinding<P>locateBinding(Parameter<P> parameter) protected <P> QueryParameterBinding<P>locateBinding(String name) protected <P> QueryParameterBinding<P>locateBinding(QueryParameterImplementor<P> parameter) protected voidprotected voidprotected abstract booleansetComment(String comment) Set a comment for this query.setHibernateFlushMode(FlushMode flushMode) Set the currentFlushModein effect for this query.Set a hint.setParameter(int position, Object value) Bind the given argument to an ordinal query parameter.setParameter(int position, Instant value, TemporalType temporalType) Bind anInstantto an ordinal query parameter using just the portion indicated by the givenTemporalType.setParameter(int position, Calendar value, TemporalType temporalType) setParameter(int position, Date value, TemporalType temporalType) setParameter(int position, P value, Class<P> javaType) Bind the given argument to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType.setParameter(int position, P value, BindableType<P> type) Bind the given argument to an ordinal query parameter using the givenBindableType.setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) setParameter(Parameter<Date> param, Date value, TemporalType temporalType) setParameter(Parameter<P> parameter, P value) setParameter(String name, Object value) Bind the given argument to a named query parameter.setParameter(String name, Instant value, TemporalType temporalType) Bind anInstantto the named query parameter using just the portion indicated by the givenTemporalType.setParameter(String name, Calendar value, TemporalType temporalType) setParameter(String name, Date value, TemporalType temporalType) setParameter(String name, P value, Class<P> javaType) Bind the given argument to a named query parameter using the givenClassreference to attempt to infer theBindableType.setParameter(String name, P value, BindableType<P> type) Bind the given argument to a named query parameter using the givenBindableType.setParameter(QueryParameter<P> parameter, P value) Bind an argument to the query parameter represented by the givenQueryParameter.setParameter(QueryParameter<P> parameter, P value, Class<P> javaType) Bind an argument to the query parameter represented by the givenQueryParameter, using the givenClassreference to attempt to infer theBindableTypeto use.setParameter(QueryParameter<P> parameter, P value, BindableType<P> type) Bind an argument to the query parameter represented by the givenQueryParameter, using the givenBindableType.setParameterList(int position, Object[] values) Bind multiple arguments to an ordinal query parameter.setParameterList(int position, Collection values) Bind multiple arguments to an ordinal query parameter.setParameterList(int position, Collection<? extends P> values, Class<P> javaType) Bind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType.setParameterList(int position, Collection<? extends P> values, BindableType<P> type) Bind multiple arguments to an ordinal query parameter using the givenBindableType.setParameterList(int position, P[] values, Class<P> javaType) Bind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType.setParameterList(int position, P[] values, BindableType<P> type) Bind multiple arguments to an ordinal query parameter using the givenBindableType.setParameterList(String name, Object[] values) Bind multiple arguments to a named query parameter.setParameterList(String name, Collection values) Bind multiple arguments to a named query parameter.setParameterList(String name, 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 toCommonQueryContract.setParameterList(String, Collection).setParameterList(String name, Collection<? extends P> values, BindableType<P> type) Bind multiple arguments to a named query parameter using the givenBindableType.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 theBindableTypeto use.setParameterList(String name, P[] values, BindableType<P> type) Bind multiple arguments to a named query parameter using the givenBindableType.setParameterList(QueryParameter<P> parameter, Collection<? extends P> values) Bind multiple arguments to the query parameter represented by the givenQueryParameter.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.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.setParameterList(QueryParameter<P> parameter, P[] values) Bind multiple arguments to the query parameter represented by the givenQueryParameter.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.setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type) Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theBindableType.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.setProperties(Map map) 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.setTimeout(int timeout) Set the query timeout in seconds.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.query.CommonQueryContract
getFlushMode, setFlushMode
-
Constructor Details
-
AbstractCommonQueryContract
-
Method Details
-
getSession
-
getIntegerLiteral
-
getMaxRows
-
getHints
-
collectHints
-
putIfNotNull
-
putIfNotNull
-
setHint
Description copied from interface:CommonQueryContractSet a hint. The hints understood by Hibernate are enumerated byAvailableHints.- Specified by:
setHintin interfaceCommonQueryContract- See Also:
-
applyHint
-
applySynchronizeSpacesHint
-
applySelectionHint
-
applyFetchSizeHint
protected void applyFetchSizeHint(int fetchSize) -
applyQueryPlanCacheableHint
protected void applyQueryPlanCacheableHint(boolean isCacheable) -
applyCacheModeHint
-
applyCacheableHint
protected void applyCacheableHint(boolean isCacheable) -
applyCacheRegionHint
-
applyEntityGraphHint
-
applyGraph
-
applyGraph
-
applyLockTimeoutHint
-
applyLockTimeoutHint
protected void applyLockTimeoutHint(int timeout) -
applyHibernateLockMode
-
applyLockModeType
-
applyLockModeHint
-
applyAliasSpecificLockModeHint
-
applyFollowOnLockingHint
-
applyAdditionalPossibleHints
-
getComment
Description copied from interface:CommonQueryContractGet the comment that has been set for this query, if any.- Specified by:
getCommentin interfaceCommonQueryContract
-
setComment
Description copied from interface:CommonQueryContractSet a comment for this query.- Specified by:
setCommentin interfaceCommonQueryContract- See Also:
-
getHibernateFlushMode
Description copied from interface:CommonQueryContractTheFlushModein effect for this query. By default, the query inherits theFlushModeof theSessionfrom which it originates.- Specified by:
getHibernateFlushModein interfaceCommonQueryContract- See Also:
-
setHibernateFlushMode
Description copied from interface:CommonQueryContractSet the currentFlushModein effect for this query.- Specified by:
setHibernateFlushModein interfaceCommonQueryContract- See Also:
-
applyJpaCacheRetrieveModeHint
-
applyJpaCacheStoreModeHint
-
applyTimeoutHint
protected void applyTimeoutHint(int timeout) -
applyCommentHint
-
applyFlushModeHint
-
applyDatabaseHint
-
getQueryOptions
-
getTimeout
Description copied from interface:CommonQueryContractObtain 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.
- Specified by:
getTimeoutin interfaceCommonQueryContract- See Also:
-
setTimeout
Description copied from interface:CommonQueryContractSet 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.
- Specified by:
setTimeoutin interfaceCommonQueryContract- Parameters:
timeout- the timeout in seconds- Returns:
this, for method chaining- See Also:
-
getMaxResults
public int getMaxResults() -
applyMaxResults
public void applyMaxResults(int maxResult) -
getFirstResult
public int getFirstResult() -
applyFirstResult
public void applyFirstResult(int startPosition) -
getJpaFlushMode
-
applyJpaFlushMode
-
applyTupleTransformer
-
applyResultListTransformer
-
getParameterMetadata
-
getParameters
-
getParameter
-
getParameter
-
getParameter
-
getParameter
-
getQueryParameterBindings
-
resolveJdbcParameterTypeIfNecessary
protected abstract boolean resolveJdbcParameterTypeIfNecessary() -
locateBinding
-
locateBinding
-
locateBinding
-
locateBinding
-
isBound
-
getParameterValue
-
getParameterValue
-
getParameterValue
-
setParameter
Description copied from interface:CommonQueryContractBind 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:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
Description copied from interface:CommonQueryContractBind the given argument to a named query parameter using the givenClassreference to attempt to infer theBindableType. If unable to infer an appropriateBindableType, fall back toCommonQueryContract.setParameter(String, Object).- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
Description copied from interface:CommonQueryContractBind the given argument to a named query parameter using the givenBindableType.- Specified by:
setParameterin interfaceCommonQueryContract
-
setParameter
Description copied from interface:CommonQueryContractBind anInstantto the named query parameter using just the portion indicated by the givenTemporalType.- Specified by:
setParameterin interfaceCommonQueryContract
-
setParameter
Description copied from interface:CommonQueryContractBind 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:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
Description copied from interface:CommonQueryContractBind the given argument to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType. If unable to infer an appropriateBindableType, fall back toCommonQueryContract.setParameter(int, Object).- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
Description copied from interface:CommonQueryContractBind the given argument to an ordinal query parameter using the givenBindableType.- Specified by:
setParameterin interfaceCommonQueryContract
-
setParameter
Description copied from interface:CommonQueryContractBind anInstantto an ordinal query parameter using just the portion indicated by the givenTemporalType.- Specified by:
setParameterin interfaceCommonQueryContract
-
setParameter
Description copied from interface:CommonQueryContractBind 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:
setParameterin interfaceCommonQueryContract- Parameters:
parameter- the query parameter mementovalue- the argument, which might be null- Returns:
this, for method chaining- See Also:
-
setParameter
public <P> CommonQueryContract setParameter(QueryParameter<P> parameter, P value, Class<P> javaType) Description copied from interface:CommonQueryContractBind 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 toCommonQueryContract.setParameter(QueryParameter, Object).- Specified by:
setParameterin interfaceCommonQueryContract- Parameters:
parameter- the query parameter mementovalue- the argument, which might be nulljavaType- aBindableTyperepresenting the type of the parameter- Returns:
this, for method chaining- See Also:
-
setParameter
public <P> CommonQueryContract setParameter(QueryParameter<P> parameter, P value, BindableType<P> type) Description copied from interface:CommonQueryContractBind an argument to the query parameter represented by the givenQueryParameter, using the givenBindableType.- Specified by:
setParameterin interfaceCommonQueryContract- Parameters:
parameter- the query parameter mementovalue- the argument, which might be nulltype- aBindableTyperepresenting the type of the parameter- Returns:
this, for method chaining
-
setParameter
- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
public CommonQueryContract setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) - Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
public CommonQueryContract setParameter(Parameter<Date> param, Date value, TemporalType temporalType) - Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameterList
Description copied from interface:CommonQueryContractBind 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:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
public <P> CommonQueryContract setParameterList(String name, Collection<? extends P> values, Class<P> javaType) Description copied from interface:CommonQueryContractBind multiple arguments to a named query parameter using the givenClassreference to attempt to infer theBindableTypeIf unable to infer an appropriateBindableType, fall back toCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
public <P> CommonQueryContract setParameterList(String name, Collection<? extends P> values, BindableType<P> type) Description copied from interface:CommonQueryContractBind multiple arguments to a named query parameter using the givenBindableType.- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:CommonQueryContractBind 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:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:CommonQueryContractBind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableTypeto use. If unable to determine an appropriateBindableType,CommonQueryContract.setParameterList(String, Collection)is used- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:CommonQueryContractBind multiple arguments to a named query parameter using the givenBindableType.- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:CommonQueryContractBind 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:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setParameterList
public <P> CommonQueryContract setParameterList(int position, Collection<? extends P> values, Class<P> javaType) Description copied from interface:CommonQueryContractBind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType. If unable to infer an appropriateBindableType, fall back toCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
public <P> CommonQueryContract setParameterList(int position, Collection<? extends P> values, BindableType<P> type) Description copied from interface:CommonQueryContractBind multiple arguments to an ordinal query parameter using the givenBindableType.- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:CommonQueryContractBind 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:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:CommonQueryContractBind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theBindableType. If unable to infer an appropriateBindableType, fall back toCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:CommonQueryContractBind multiple arguments to an ordinal query parameter using the givenBindableType.- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setParameterList
public <P> CommonQueryContract setParameterList(QueryParameter<P> parameter, Collection<? extends P> values) Description copied from interface:CommonQueryContractBind 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:
setParameterListin interfaceCommonQueryContract- Parameters:
parameter- the parameter mementovalues- a collection of arguments- Returns:
this, for method chaining
-
setParameterList
public <P> CommonQueryContract setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType) Description copied from interface:CommonQueryContractBind 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 usingCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
public <P> CommonQueryContract setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, BindableType<P> type) Description copied from interface:CommonQueryContractBind multiple arguments to the query parameter represented by the givenQueryParameter, using the givenBindableType.- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:CommonQueryContractBind 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.- Specified by:
setParameterListin interfaceCommonQueryContract- Parameters:
parameter- the parameter mementovalues- a collection of arguments- Returns:
this, for method chaining
-
setParameterList
public <P> CommonQueryContract setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType) Description copied from interface:CommonQueryContractBind 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 usingCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
public <P> CommonQueryContract setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type) Description copied from interface:CommonQueryContractBind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theBindableType.- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
setProperties
Description copied from interface:CommonQueryContractBind 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.- Specified by:
setPropertiesin interfaceCommonQueryContract- Parameters:
map- aMapof names to arguments- Returns:
this, for method chaining
-
determineType
-
setProperties
Description copied from interface:CommonQueryContractBind 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:
setPropertiesin interfaceCommonQueryContract- Parameters:
bean- any JavaBean or POJO- Returns:
this, for method chaining
-