Class AbstractQuery<R>
- java.lang.Object
-
- org.hibernate.query.spi.AbstractCommonQueryContract
-
- org.hibernate.query.spi.AbstractSelectionQuery<R>
-
- org.hibernate.query.spi.AbstractQuery<R>
-
- All Implemented Interfaces:
Query
,TypedQuery<R>
,CommonQueryContract
,MutationQuery
,Query<R>
,SelectionQuery<R>
,DomainQueryExecutionContext
,QueryImplementor<R>
- Direct Known Subclasses:
NativeQueryImpl
,ProcedureCallImpl
public abstract class AbstractQuery<R> extends AbstractSelectionQuery<R> implements QueryImplementor<R>
-
-
Field Summary
Fields Modifier and Type Field Description protected static EntityManagerMessageLogger
log
-
Fields inherited from class org.hibernate.query.spi.AbstractSelectionQuery
CRITERIA_HQL_STRING
-
-
Constructor Summary
Constructors Constructor Description AbstractQuery(SharedSessionContractImplementor session)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description QueryImplementor<R>
addQueryHint(String hint)
Add a database query hint to the SQL query.protected void
applyOptions(NamedQueryMemento memento)
protected void
collectHints(Map<String,Object> hints)
QueryImplementor<R>
disableFetchProfile(String profileName)
Disable thefetch profile
with the given name in this session.protected abstract int
doExecuteUpdate()
QueryImplementor<R>
enableFetchProfile(String profileName)
Enable thefetch profile
for this query.int
executeUpdate()
Execute an insert, update, or delete statement, and return the number of affected entities.String
getComment()
Get the comment that has been set for this query, if any.int
getFirstResult()
The first row position to return from the query results.FlushModeType
getFlushMode()
The JPAFlushModeType
in effect for this query.KeyedResultList<R>
getKeyedResultList(KeyedPage<R> keyedPage)
Execute the query and return the results for the given page, using key-based pagination.LockModeType
getLockMode()
Get the rootLockModeType
for the queryLockOptions
getLockOptions()
TheLockOptions
currently in effect for the queryint
getMaxResults()
The max number of rows requested for the query resultsSet<Parameter<?>>
getParameters()
MutableQueryOptions
getQueryOptions()
Get the execution options for thisQuery
.Set<String>
getSupportedHints()
boolean
isCacheable()
Should the results of the query be stored in the second level cache?protected void
prepareForExecution()
protected boolean
resolveJdbcParameterTypeIfNecessary()
QueryImplementor<R>
setCacheable(boolean cacheable)
Enable/disable second level query (result) caching for this query.QueryImplementor<R>
setCacheMode(CacheMode cacheMode)
Set the currentCacheMode
in effect for this query.QueryImplementor<R>
setCacheRegion(String cacheRegion)
Set the name of the cache region where query results should be cached (assumingSelectionQuery.isCacheable()
).QueryImplementor<R>
setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode)
QueryImplementor<R>
setCacheStoreMode(CacheStoreMode cacheStoreMode)
QueryImplementor<R>
setComment(String comment)
Set a comment for this query.QueryImplementor<R>
setEntityGraph(EntityGraph<R> graph, GraphSemantic semantic)
Apply anEntityGraph
to the query.QueryImplementor<R>
setFetchSize(int fetchSize)
Sets a JDBC fetch size hint for the query.QueryImplementor<R>
setFirstResult(int startPosition)
Set the first row position to return from the query results.QueryImplementor<R>
setFlushMode(FlushModeType flushModeType)
Set theFlushMode
in to use for this query.QueryImplementor<R>
setHibernateFlushMode(FlushMode flushMode)
Set the currentFlushMode
in effect for this query.QueryImplementor<R>
setHint(String hintName, Object value)
Set a hint.QueryImplementor<R>
setLockMode(LockModeType lockModeType)
Specify the root LockModeType for the queryQueryImplementor<R>
setLockMode(String alias, LockMode lockMode)
Specify aLockMode
to apply to a specific alias defined in the queryQueryImplementor<R>
setLockOptions(LockOptions lockOptions)
Apply the given lock options to this query.QueryImplementor<R>
setMaxResults(int maxResult)
Set the max number of rows requested for the query results.void
setOptionalEntityName(String entityName)
void
setOptionalId(Serializable id)
void
setOptionalObject(Object optionalObject)
Query<R>
setOrder(List<Order<? super R>> orders)
If the result type of this query is an entity class, add one or more rules for ordering the query results.Query<R>
setOrder(Order<? super R> order)
If the result type of this query is an entity class, add a rule for ordering the query results.QueryImplementor<R>
setParameter(int position, Object value)
Bind the given argument to an ordinal query parameter.QueryImplementor<R>
setParameter(int position, Instant value, TemporalType temporalType)
Bind anInstant
to an ordinal query parameter using just the portion indicated by the givenTemporalType
.QueryImplementor<R>
setParameter(int position, Calendar value, TemporalType temporalType)
Query
overrideQueryImplementor<R>
setParameter(int position, Date value, TemporalType temporalType)
Query
override<P> QueryImplementor<R>
setParameter(int position, P value, Class<P> javaTypeClass)
Bind the given argument to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
.<P> QueryImplementor<R>
setParameter(int position, P value, BindableType<P> type)
Bind the given argument to an ordinal query parameter using the givenBindableType
.QueryImplementor<R>
setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
Query
overrideQueryImplementor<R>
setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
Query
override<P> QueryImplementor<R>
setParameter(Parameter<P> parameter, P value)
Query
overrideQueryImplementor<R>
setParameter(String name, Object value)
Bind the given argument to a named query parameter.QueryImplementor<R>
setParameter(String name, Instant value, TemporalType temporalType)
Bind anInstant
to the named query parameter using just the portion indicated by the givenTemporalType
.QueryImplementor<R>
setParameter(String name, Calendar value, TemporalType temporalType)
Query
overrideQueryImplementor<R>
setParameter(String name, Date value, TemporalType temporalType)
Query
override<P> QueryImplementor<R>
setParameter(String name, P value, Class<P> javaTypeClass)
Bind the given argument to a named query parameter using the givenClass
reference to attempt to infer theBindableType
.<P> QueryImplementor<R>
setParameter(String name, P value, BindableType<P> type)
Bind the given argument to a named query parameter using the givenBindableType
.<P> QueryImplementor<R>
setParameter(QueryParameter<P> parameter, P value)
Bind an argument to the query parameter represented by the givenQueryParameter
.<P> QueryImplementor<R>
setParameter(QueryParameter<P> parameter, P value, Class<P> javaTypeClass)
Bind an argument to the query parameter represented by the givenQueryParameter
, using the givenClass
reference to attempt to infer theBindableType
to use.<P> QueryImplementor<R>
setParameter(QueryParameter<P> parameter, P value, BindableType<P> type)
Bind an argument to the query parameter represented by the givenQueryParameter
, using the givenBindableType
.QueryImplementor<R>
setParameterList(int position, Object[] values)
Bind multiple arguments to an ordinal query parameter.QueryImplementor<R>
setParameterList(int position, Collection values)
Bind multiple arguments to an ordinal query parameter.<P> QueryImplementor<R>
setParameterList(int position, Collection<? extends P> values, Class<P> javaTypeClass)
Bind multiple arguments to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
.<P> QueryImplementor<R>
setParameterList(int position, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.<P> QueryImplementor<R>
setParameterList(int position, P[] values, Class<P> javaTypeClass)
Bind multiple arguments to an ordinal query parameter using the givenClass
reference to attempt to infer theBindableType
.<P> QueryImplementor<R>
setParameterList(int position, P[] values, BindableType<P> type)
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.QueryImplementor<R>
setParameterList(String name, Object[] values)
Bind multiple arguments to a named query parameter.QueryImplementor<R>
setParameterList(String name, Collection values)
Bind multiple arguments to a named query parameter.<P> QueryImplementor<R>
setParameterList(String name, Collection<? extends P> values, Class<P> javaTypeClass)
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> QueryImplementor<R>
setParameterList(String name, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to a named query parameter using the givenBindableType
.<P> QueryImplementor<R>
setParameterList(String name, P[] values, Class<P> javaTypeClass)
Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableType
to use.<P> QueryImplementor<R>
setParameterList(String name, P[] values, BindableType<P> type)
Bind multiple arguments to a named query parameter using the givenBindableType
.<P> QueryImplementor<R>
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.<P> QueryImplementor<R>
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaTypeClass)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the givenClass
reference to attempt to infer theBindableType
to use.<P> QueryImplementor<R>
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> QueryImplementor<R>
setParameterList(QueryParameter<P> parameter, P[] values)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.<P> QueryImplementor<R>
setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaTypeClass)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the givenClass
reference to attempt to infer theBindableType
to use.<P> QueryImplementor<R>
setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, using the given theBindableType
.QueryImplementor<R>
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.QueryImplementor<R>
setProperties(Map map)
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.QueryImplementor<R>
setQueryPlanCacheable(boolean queryPlanCacheable)
Enable/disable query plan caching for this query.QueryImplementor<R>
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies loaded by thisQuery
.QueryImplementor<R>
setResultListTransformer(ResultListTransformer<R> transformer)
Set aResultListTransformer
.QueryImplementor<R>
setTimeout(int timeout)
Set the query timeout in seconds.<T> QueryImplementor<T>
setTupleTransformer(TupleTransformer<T> transformer)
Set aTupleTransformer
.-
Methods inherited from class org.hibernate.query.spi.AbstractSelectionQuery
afterQuery, afterQuery, afterQueryHandlingFetchProfiles, beforeQuery, beforeQueryHandlingFetchProfiles, doList, doScroll, getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getCallback, getFetchSize, getHibernateLockMode, getQueryString, getResultStream, getSessionFactory, getSingleResult, getSingleResultOrNull, hasCallbackActions, isQueryPlanCacheable, isReadOnly, list, requiresTxn, resetCallback, scroll, scroll, setAliasSpecificLockMode, setFollowOnLocking, setHibernateLockMode, stream, uniqueElement, uniqueResult, uniqueResultOptional
-
Methods inherited from class org.hibernate.query.spi.AbstractCommonQueryContract
applyAdditionalPossibleHints, applyAliasSpecificLockModeHint, applyCacheableHint, applyCacheModeHint, applyCacheRegionHint, applyCommentHint, applyDatabaseHint, applyEntityGraphHint, applyFetchSizeHint, applyFirstResult, applyFlushModeHint, applyFollowOnLockingHint, applyGraph, applyGraph, applyHibernateLockMode, applyHint, applyJpaCacheRetrieveModeHint, applyJpaCacheStoreModeHint, applyJpaFlushMode, applyLockModeHint, applyLockModeType, applyLockTimeoutHint, applyLockTimeoutHint, applyMaxResults, applyQueryPlanCacheableHint, applyResultListTransformer, applySelectionHint, applySynchronizeSpacesHint, applyTimeoutHint, applyTupleTransformer, determineType, getHibernateFlushMode, getHints, getIntegerLiteral, getJpaFlushMode, getMaxRows, getParameter, getParameter, getParameter, getParameter, getParameterMetadata, getParameterValue, getParameterValue, getParameterValue, getQueryParameterBindings, getSession, getTimeout, isBound, locateBinding, locateBinding, locateBinding, locateBinding, putIfNotNull, putIfNotNull
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.query.CommonQueryContract
getHibernateFlushMode, getTimeout
-
Methods inherited from interface org.hibernate.query.spi.DomainQueryExecutionContext
getQueryParameterBindings, getResultType, getSession
-
Methods inherited from interface jakarta.persistence.Query
getHints, getParameter, getParameter, getParameter, getParameter, getParameterValue, getParameterValue, getParameterValue, isBound, unwrap
-
Methods inherited from interface org.hibernate.query.Query
applyFetchGraph, applyGraph, applyLoadGraph, getParameterMetadata, getQueryString, getResultList, getResultStream, getSingleResult, list, setPage, stream, uniqueResult, uniqueResultOptional
-
Methods inherited from interface org.hibernate.query.spi.QueryImplementor
getParameterBindings, getSession, scroll, scroll, setResultTransformer
-
Methods inherited from interface org.hibernate.query.SelectionQuery
getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getFetchSize, getHibernateLockMode, getResultCount, getSingleResultOrNull, isQueryPlanCacheable, isReadOnly, setAliasSpecificLockMode, setFollowOnLocking, setHibernateLockMode
-
-
-
-
Field Detail
-
log
protected static final EntityManagerMessageLogger log
-
-
Constructor Detail
-
AbstractQuery
public AbstractQuery(SharedSessionContractImplementor session)
-
-
Method Detail
-
applyOptions
protected void applyOptions(NamedQueryMemento memento)
- Overrides:
applyOptions
in classAbstractSelectionQuery<R>
-
setHint
public QueryImplementor<R> setHint(String hintName, Object value)
Description copied from interface:CommonQueryContract
Set a hint. The hints understood by Hibernate are enumerated byAvailableHints
.- Specified by:
setHint
in interfaceCommonQueryContract
- Specified by:
setHint
in interfaceMutationQuery
- Specified by:
setHint
in interfaceQuery
- Specified by:
setHint
in interfaceQuery<R>
- Specified by:
setHint
in interfaceSelectionQuery<R>
- Specified by:
setHint
in interfaceTypedQuery<R>
- Overrides:
setHint
in classAbstractSelectionQuery<R>
- See Also:
HibernateHints
,SpecHints
-
setEntityGraph
public QueryImplementor<R> setEntityGraph(EntityGraph<R> graph, GraphSemantic semantic)
Description copied from interface:SelectionQuery
Apply anEntityGraph
to the query.This is an alternative way to specify the associations which should be fetched as part of the initial query.
- Specified by:
setEntityGraph
in interfaceQuery<R>
- Specified by:
setEntityGraph
in interfaceSelectionQuery<R>
- Overrides:
setEntityGraph
in classAbstractSelectionQuery<R>
-
enableFetchProfile
public QueryImplementor<R> enableFetchProfile(String profileName)
Description copied from interface:SelectionQuery
Enable thefetch profile
for this query. If the requested fetch profile is already enabled, the call has no effect.This is an alternative way to specify the associations which should be fetched as part of the initial query.
- Specified by:
enableFetchProfile
in interfaceQuery<R>
- Specified by:
enableFetchProfile
in interfaceSelectionQuery<R>
- Overrides:
enableFetchProfile
in classAbstractSelectionQuery<R>
- Parameters:
profileName
- the name of the fetch profile to be enabled- See Also:
FetchProfile
-
disableFetchProfile
public QueryImplementor<R> disableFetchProfile(String profileName)
Description copied from interface:SelectionQuery
Disable thefetch profile
with the given name in this session. If the requested fetch profile is not currently enabled, the call has no effect.- Specified by:
disableFetchProfile
in interfaceQuery<R>
- Specified by:
disableFetchProfile
in interfaceSelectionQuery<R>
- Overrides:
disableFetchProfile
in classAbstractSelectionQuery<R>
- Parameters:
profileName
- the name of the fetch profile to be disabled- See Also:
FetchProfile
-
getQueryOptions
public MutableQueryOptions getQueryOptions()
Description copied from interface:Query
Get the execution options for thisQuery
. Many of the setters of this object update the state of the returnedQueryOptions
. This is useful because it gives access to s primitive value in its (nullable) wrapper form, rather than the primitive form as required by JPA. This allows us to distinguish whether a value has been explicitly set by the client.- Specified by:
getQueryOptions
in interfaceDomainQueryExecutionContext
- Specified by:
getQueryOptions
in interfaceQuery<R>
- Overrides:
getQueryOptions
in classAbstractCommonQueryContract
- Returns:
- Return the encapsulation of this query's options.
-
getMaxResults
public int getMaxResults()
Description copied from interface:SelectionQuery
The max number of rows requested for the query results- Specified by:
getMaxResults
in interfaceQuery
- Specified by:
getMaxResults
in interfaceSelectionQuery<R>
- Overrides:
getMaxResults
in classAbstractCommonQueryContract
-
setMaxResults
public QueryImplementor<R> setMaxResults(int maxResult)
Description copied from interface:SelectionQuery
Set the max number of rows requested for the query results. Applied to the SQL query- Specified by:
setMaxResults
in interfaceQuery
- Specified by:
setMaxResults
in interfaceQuery<R>
- Specified by:
setMaxResults
in interfaceSelectionQuery<R>
- Specified by:
setMaxResults
in interfaceTypedQuery<R>
- Overrides:
setMaxResults
in classAbstractSelectionQuery<R>
-
getFirstResult
public int getFirstResult()
Description copied from interface:SelectionQuery
The first row position to return from the query results. Applied to the SQL query.- Specified by:
getFirstResult
in interfaceQuery
- Specified by:
getFirstResult
in interfaceSelectionQuery<R>
- Overrides:
getFirstResult
in classAbstractCommonQueryContract
-
setFirstResult
public QueryImplementor<R> setFirstResult(int startPosition)
Description copied from interface:SelectionQuery
Set the first row position to return from the query results. Applied to the SQL query.- Specified by:
setFirstResult
in interfaceQuery
- Specified by:
setFirstResult
in interfaceQuery<R>
- Specified by:
setFirstResult
in interfaceSelectionQuery<R>
- Specified by:
setFirstResult
in interfaceTypedQuery<R>
- Overrides:
setFirstResult
in classAbstractSelectionQuery<R>
-
setTupleTransformer
public <T> QueryImplementor<T> setTupleTransformer(TupleTransformer<T> transformer)
Description copied from interface:Query
Set aTupleTransformer
.- Specified by:
setTupleTransformer
in interfaceQuery<R>
- Specified by:
setTupleTransformer
in interfaceQueryImplementor<R>
-
setResultListTransformer
public QueryImplementor<R> setResultListTransformer(ResultListTransformer<R> transformer)
Description copied from interface:Query
Set aResultListTransformer
.- Specified by:
setResultListTransformer
in interfaceQuery<R>
- Specified by:
setResultListTransformer
in interfaceQueryImplementor<R>
-
setHibernateFlushMode
public QueryImplementor<R> setHibernateFlushMode(FlushMode flushMode)
Description copied from interface:CommonQueryContract
Set the currentFlushMode
in effect for this query.- Specified by:
setHibernateFlushMode
in interfaceCommonQueryContract
- Specified by:
setHibernateFlushMode
in interfaceMutationQuery
- Specified by:
setHibernateFlushMode
in interfaceQuery<R>
- Specified by:
setHibernateFlushMode
in interfaceSelectionQuery<R>
- Overrides:
setHibernateFlushMode
in classAbstractSelectionQuery<R>
- See Also:
CommonQueryContract.getHibernateFlushMode()
,Session.getHibernateFlushMode()
-
getFlushMode
public FlushModeType getFlushMode()
Description copied from interface:CommonQueryContract
The JPAFlushModeType
in effect for this query. By default, the query inherits theFlushMode
of theSession
from which it originates.- Specified by:
getFlushMode
in interfaceCommonQueryContract
- Specified by:
getFlushMode
in interfaceQuery
- Overrides:
getFlushMode
in classAbstractSelectionQuery<R>
- See Also:
CommonQueryContract.getHibernateFlushMode()
,Session.getHibernateFlushMode()
-
setFlushMode
public QueryImplementor<R> setFlushMode(FlushModeType flushModeType)
Description copied from interface:CommonQueryContract
Set theFlushMode
in to use for this query.- Specified by:
setFlushMode
in interfaceCommonQueryContract
- Specified by:
setFlushMode
in interfaceMutationQuery
- Specified by:
setFlushMode
in interfaceQuery
- Specified by:
setFlushMode
in interfaceQuery<R>
- Specified by:
setFlushMode
in interfaceSelectionQuery<R>
- Specified by:
setFlushMode
in interfaceTypedQuery<R>
- Overrides:
setFlushMode
in classAbstractSelectionQuery<R>
- See Also:
CommonQueryContract.getHibernateFlushMode()
,Session.getHibernateFlushMode()
-
setCacheMode
public QueryImplementor<R> setCacheMode(CacheMode cacheMode)
Description copied from interface:SelectionQuery
Set the currentCacheMode
in effect for this query.- Specified by:
setCacheMode
in interfaceQuery<R>
- Specified by:
setCacheMode
in interfaceSelectionQuery<R>
- Overrides:
setCacheMode
in classAbstractSelectionQuery<R>
- See Also:
SelectionQuery.getCacheMode()
,Session.setCacheMode(CacheMode)
-
setCacheRetrieveMode
public QueryImplementor<R> setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode)
- Specified by:
setCacheRetrieveMode
in interfaceQuery<R>
- Specified by:
setCacheRetrieveMode
in interfaceSelectionQuery<R>
- Overrides:
setCacheRetrieveMode
in classAbstractSelectionQuery<R>
- See Also:
SelectionQuery.setCacheMode(CacheMode)
-
setCacheStoreMode
public QueryImplementor<R> setCacheStoreMode(CacheStoreMode cacheStoreMode)
- Specified by:
setCacheStoreMode
in interfaceQuery<R>
- Specified by:
setCacheStoreMode
in interfaceSelectionQuery<R>
- Overrides:
setCacheStoreMode
in classAbstractSelectionQuery<R>
- See Also:
SelectionQuery.setCacheMode(CacheMode)
-
isCacheable
public boolean isCacheable()
Description copied from interface:SelectionQuery
Should the results of the query be stored in the second level cache?This is different to second level caching of any returned entities and collections, which is controlled by
SelectionQuery.getCacheMode()
.The query being "eligible" for caching does not necessarily mean its results will be cached. Second-level query caching still has to be enabled on the
SessionFactory
for this to happen. Usually that is controlled by the configuration setting "hibernate.cache.use_query_cache".- Specified by:
isCacheable
in interfaceSelectionQuery<R>
- Overrides:
isCacheable
in classAbstractSelectionQuery<R>
-
setCacheable
public QueryImplementor<R> setCacheable(boolean cacheable)
Description copied from interface:SelectionQuery
Enable/disable second level query (result) caching for this query.- Specified by:
setCacheable
in interfaceQuery<R>
- Specified by:
setCacheable
in interfaceSelectionQuery<R>
- Overrides:
setCacheable
in classAbstractSelectionQuery<R>
- See Also:
SelectionQuery.isCacheable()
-
setCacheRegion
public QueryImplementor<R> setCacheRegion(String cacheRegion)
Description copied from interface:SelectionQuery
Set the name of the cache region where query results should be cached (assumingSelectionQuery.isCacheable()
).null
indicates to use the default region.- Specified by:
setCacheRegion
in interfaceQuery<R>
- Specified by:
setCacheRegion
in interfaceSelectionQuery<R>
- Overrides:
setCacheRegion
in classAbstractSelectionQuery<R>
- See Also:
SelectionQuery.getCacheRegion()
-
setQueryPlanCacheable
public QueryImplementor<R> setQueryPlanCacheable(boolean queryPlanCacheable)
Description copied from interface:SelectionQuery
Enable/disable query plan caching for this query.- Specified by:
setQueryPlanCacheable
in interfaceSelectionQuery<R>
- Overrides:
setQueryPlanCacheable
in classAbstractSelectionQuery<R>
- See Also:
SelectionQuery.isQueryPlanCacheable()
-
setTimeout
public QueryImplementor<R> setTimeout(int timeout)
Description copied from interface:CommonQueryContract
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.
- Specified by:
setTimeout
in interfaceCommonQueryContract
- Specified by:
setTimeout
in interfaceMutationQuery
- Specified by:
setTimeout
in interfaceQuery<R>
- Specified by:
setTimeout
in interfaceSelectionQuery<R>
- Overrides:
setTimeout
in classAbstractSelectionQuery<R>
- Parameters:
timeout
- the timeout in seconds- Returns:
this
, for method chaining- See Also:
CommonQueryContract.getTimeout()
-
setFetchSize
public QueryImplementor<R> setFetchSize(int fetchSize)
Description copied from interface:SelectionQuery
Sets a JDBC fetch size hint for the query.- Specified by:
setFetchSize
in interfaceQuery<R>
- Specified by:
setFetchSize
in interfaceSelectionQuery<R>
- Overrides:
setFetchSize
in classAbstractSelectionQuery<R>
- Parameters:
fetchSize
- the fetch size hint- Returns:
this
, for method chaining- See Also:
SelectionQuery.getFetchSize()
-
setReadOnly
public QueryImplementor<R> setReadOnly(boolean readOnly)
Description copied from interface:SelectionQuery
Set the read-only/modifiable mode for entities and proxies loaded by thisQuery
. This setting overrides the default setting for the persistence context,Session.isDefaultReadOnly()
.To set the default read-only/modifiable setting used for entities and proxies that are loaded into the session, use
Session.setDefaultReadOnly(boolean)
.Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted.
When a proxy is initialized, the loaded entity will have the same read-only/modifiable setting as the uninitialized proxy has, regardless of the session's current setting.
The read-only/modifiable setting has no impact on entities/proxies returned by the query that existed in the session beforeQuery the query was executed.
- Specified by:
setReadOnly
in interfaceQuery<R>
- Specified by:
setReadOnly
in interfaceSelectionQuery<R>
- Overrides:
setReadOnly
in classAbstractSelectionQuery<R>
- Parameters:
readOnly
-true
indicates that entities and proxies loaded by the query are to be put in read-only mode;false
indicates that entities and proxies loaded by the query will be put in modifiable mode- Returns:
this
, for method chaining
-
getLockOptions
public LockOptions getLockOptions()
Description copied from interface:SelectionQuery
TheLockOptions
currently in effect for the query- Specified by:
getLockOptions
in interfaceQuery<R>
- Specified by:
getLockOptions
in interfaceSelectionQuery<R>
- Overrides:
getLockOptions
in classAbstractSelectionQuery<R>
- Returns:
- The
LockOptions
currently in effect - See Also:
LockOptions
-
getLockMode
public LockModeType getLockMode()
Description copied from interface:SelectionQuery
Get the rootLockModeType
for the query- Specified by:
getLockMode
in interfaceQuery
- Specified by:
getLockMode
in interfaceSelectionQuery<R>
- Overrides:
getLockMode
in classAbstractSelectionQuery<R>
- See Also:
SelectionQuery.getHibernateLockMode()
-
setLockOptions
public QueryImplementor<R> setLockOptions(LockOptions lockOptions)
Description copied from interface:Query
Apply the given lock options to this query. Alias-specific lock modes in the given lock options are merged with any alias-specific lock mode which have already been set. If a lock mode has already been specified for an alias that is among the aliases in the given lock options, the lock mode specified in the given lock options overrides the lock mode that was already set.- Specified by:
setLockOptions
in interfaceQuery<R>
- Parameters:
lockOptions
- The lock options to apply to the query.- Returns:
this
, for method chaining- See Also:
Query.getLockOptions()
-
setLockMode
public QueryImplementor<R> setLockMode(String alias, LockMode lockMode)
Description copied from interface:SelectionQuery
Specify aLockMode
to apply to a specific alias defined in the query- Specified by:
setLockMode
in interfaceQuery<R>
- Specified by:
setLockMode
in interfaceSelectionQuery<R>
- Overrides:
setLockMode
in classAbstractSelectionQuery<R>
- Parameters:
alias
- A query aliaslockMode
- The lock mode to apply- Returns:
this
, for method chaining- See Also:
Query.getLockOptions()
-
setLockMode
public QueryImplementor<R> setLockMode(LockModeType lockModeType)
Description copied from class:AbstractSelectionQuery
Specify the root LockModeType for the query- Specified by:
setLockMode
in interfaceQuery
- Specified by:
setLockMode
in interfaceQuery<R>
- Specified by:
setLockMode
in interfaceSelectionQuery<R>
- Specified by:
setLockMode
in interfaceTypedQuery<R>
- Overrides:
setLockMode
in classAbstractSelectionQuery<R>
- See Also:
AbstractSelectionQuery.setHibernateLockMode(org.hibernate.LockMode)
-
setOrder
public Query<R> setOrder(List<Order<? super R>> orders)
Description copied from interface:SelectionQuery
If the result type of this query is an entity class, add one or more rules for ordering the query results.
-
setOrder
public Query<R> setOrder(Order<? super R> order)
Description copied from interface:SelectionQuery
If the result type of this query is an entity class, add a rule for ordering the query results.
-
getComment
public String getComment()
Description copied from interface:CommonQueryContract
Get the comment that has been set for this query, if any.- Specified by:
getComment
in interfaceCommonQueryContract
- Specified by:
getComment
in interfaceQuery<R>
- Overrides:
getComment
in classAbstractCommonQueryContract
- Returns:
- The comment.
-
setComment
public QueryImplementor<R> setComment(String comment)
Description copied from interface:CommonQueryContract
Set a comment for this query.- Specified by:
setComment
in interfaceCommonQueryContract
- Specified by:
setComment
in interfaceMutationQuery
- Specified by:
setComment
in interfaceQuery<R>
- Specified by:
setComment
in interfaceSelectionQuery<R>
- Overrides:
setComment
in classAbstractSelectionQuery<R>
- Parameters:
comment
- The human-readable comment- Returns:
this
, for method chaining- See Also:
Query.setComment(String)
-
addQueryHint
public QueryImplementor<R> addQueryHint(String hint)
Description copied from interface:Query
Add a database query hint to the SQL query.A database hint is a completely different concept to a JPA hint specified using
QueryHint
orQuery.getHints()
. These are hints to the JPA provider.Multiple query hints may be specified. The operation
Dialect.getQueryHintString(String, List)
determines how the hint is actually added to the SQL query.- Specified by:
addQueryHint
in interfaceQuery<R>
- Parameters:
hint
- The database specific query hint to add.
-
collectHints
protected void collectHints(Map<String,Object> hints)
- Overrides:
collectHints
in classAbstractSelectionQuery<R>
-
resolveJdbcParameterTypeIfNecessary
protected boolean resolveJdbcParameterTypeIfNecessary()
- Specified by:
resolveJdbcParameterTypeIfNecessary
in classAbstractCommonQueryContract
-
getParameters
public Set<Parameter<?>> getParameters()
- Specified by:
getParameters
in interfaceQuery
- Overrides:
getParameters
in classAbstractCommonQueryContract
-
setParameter
public QueryImplementor<R> 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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
CommonQueryContract.setParameter(String, Object, Class)
,CommonQueryContract.setParameter(String, Object, BindableType)
-
setParameter
public <P> QueryImplementor<R> setParameter(String name, P value, Class<P> javaTypeClass)
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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
CommonQueryContract.setParameter(String, Object, BindableType)
-
setParameter
public <P> QueryImplementor<R> 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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
-
setParameter
public QueryImplementor<R> setParameter(String name, Instant value, 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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
-
setParameter
public QueryImplementor<R> 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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
CommonQueryContract.setParameter(int, Object, Class)
,CommonQueryContract.setParameter(int, Object, BindableType)
-
setParameter
public <P> QueryImplementor<R> setParameter(int position, P value, Class<P> javaTypeClass)
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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
CommonQueryContract.setParameter(int, Object, BindableType)
-
setParameter
public <P> QueryImplementor<R> 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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
-
setParameter
public QueryImplementor<R> setParameter(int position, Instant value, 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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
-
setParameter
public <P> QueryImplementor<R> setParameter(QueryParameter<P> parameter, P 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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- 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
public <P> QueryImplementor<R> setParameter(QueryParameter<P> parameter, P value, Class<P> javaTypeClass)
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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- Parameters:
parameter
- the query parameter mementovalue
- the argument, which might be nulljavaTypeClass
- aBindableType
representing the type of the parameter- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameter(QueryParameter, Object, BindableType)
-
setParameter
public <P> QueryImplementor<R> setParameter(QueryParameter<P> parameter, P value, 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
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- Parameters:
parameter
- the query parameter mementovalue
- the argument, which might be nulltype
- aBindableType
representing the type of the parameter- Returns:
this
, for method chaining
-
setParameter
public <P> QueryImplementor<R> setParameter(Parameter<P> parameter, P value)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
Query.setParameter(Parameter, Object)
-
setParameterList
public QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(java.lang.String, java.util.Collection, BindableType)
-
setParameterList
public <P> QueryImplementor<R> setParameterList(String name, Collection<? extends P> values, Class<P> javaTypeClass)
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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(java.lang.String, java.util.Collection, BindableType)
-
setParameterList
public <P> QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameterList
public QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameterList
public <P> QueryImplementor<R> setParameterList(String name, P[] values, Class<P> javaTypeClass)
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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(java.lang.String, Object[], BindableType)
-
setParameterList
public <P> QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameterList
public QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameterList
public <P> QueryImplementor<R> setParameterList(int position, Collection<? extends P> values, Class<P> javaTypeClass)
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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(int, Collection, BindableType)
-
setParameterList
public <P> QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameterList
public QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameterList
public <P> QueryImplementor<R> setParameterList(int position, P[] values, Class<P> javaTypeClass)
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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(int, Object[], BindableType)
-
setParameterList
public <P> QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameterList
public <P> QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Parameters:
parameter
- the parameter mementovalues
- a collection of arguments- Returns:
this
, for method chaining
-
setParameterList
public <P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaTypeClass)
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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(QueryParameter, java.util.Collection, BindableType)
-
setParameterList
public <P> QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameterList
public <P> QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Parameters:
parameter
- the parameter mementovalues
- a collection of arguments- Returns:
this
, for method chaining
-
setParameterList
public <P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaTypeClass)
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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining- See Also:
CommonQueryContract.setParameterList(QueryParameter, Object[], BindableType)
-
setParameterList
public <P> QueryImplementor<R> 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
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<R>
- Specified by:
setParameterList
in interfaceQueryImplementor<R>
- Specified by:
setParameterList
in interfaceSelectionQuery<R>
- Overrides:
setParameterList
in classAbstractSelectionQuery<R>
- Returns:
this
, for method chaining
-
setParameter
public QueryImplementor<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
Query.setParameter(Parameter, Calendar, TemporalType)
-
setParameter
public QueryImplementor<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
Query.setParameter(Parameter, Date, TemporalType)
-
setParameter
public QueryImplementor<R> setParameter(String name, Calendar value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
Query.setParameter(String, Calendar, TemporalType)
-
setParameter
public QueryImplementor<R> setParameter(String name, Date value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
Query.setParameter(String, Date, TemporalType)
-
setParameter
public QueryImplementor<R> setParameter(int position, Calendar value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
Query.setParameter(int, Calendar, TemporalType)
-
setParameter
public QueryImplementor<R> setParameter(int position, Date value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<R>
- Specified by:
setParameter
in interfaceQueryImplementor<R>
- Specified by:
setParameter
in interfaceSelectionQuery<R>
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Overrides:
setParameter
in classAbstractSelectionQuery<R>
- See Also:
Query.setParameter(int, Date, TemporalType)
-
setProperties
public QueryImplementor<R> 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
- Specified by:
setProperties
in interfaceMutationQuery
- Specified by:
setProperties
in interfaceQuery<R>
- Specified by:
setProperties
in interfaceQueryImplementor<R>
- Specified by:
setProperties
in interfaceSelectionQuery<R>
- Overrides:
setProperties
in classAbstractSelectionQuery<R>
- Parameters:
bean
- any JavaBean or POJO- Returns:
this
, for method chaining
-
setProperties
public QueryImplementor<R> setProperties(Map map)
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
- Specified by:
setProperties
in interfaceMutationQuery
- Specified by:
setProperties
in interfaceQuery<R>
- Specified by:
setProperties
in interfaceQueryImplementor<R>
- Specified by:
setProperties
in interfaceSelectionQuery<R>
- Overrides:
setProperties
in classAbstractSelectionQuery<R>
- Parameters:
map
- aMap
of names to arguments- Returns:
this
, for method chaining
-
prepareForExecution
protected void prepareForExecution()
- Specified by:
prepareForExecution
in classAbstractSelectionQuery<R>
-
executeUpdate
public int executeUpdate() throws HibernateException
Description copied from interface:Query
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)
.- Specified by:
executeUpdate
in interfaceMutationQuery
- Specified by:
executeUpdate
in interfaceQuery
- Specified by:
executeUpdate
in interfaceQuery<R>
- Returns:
- the number of affected entity instances (may differ from the number of affected rows)
- Throws:
HibernateException
- See Also:
QueryProducer.createMutationQuery(java.lang.String)
,QueryProducer.createMutationQuery(String)
,QueryProducer.createNamedMutationQuery(String)
,QueryProducer.createNativeMutationQuery(String)
,Query.executeUpdate()
,QueryProducer.createMutationQuery(java.lang.String)
-
doExecuteUpdate
protected abstract int doExecuteUpdate()
-
getKeyedResultList
public KeyedResultList<R> getKeyedResultList(KeyedPage<R> keyedPage)
Description copied from interface:SelectionQuery
Execute the query and return the results for the given page, using key-based pagination.- Specified by:
getKeyedResultList
in interfaceSelectionQuery<R>
- Parameters:
keyedPage
- the key-based specification of the page as an instance ofKeyedPage
- Returns:
- the query results and the key of the next page
as an instance of
KeyedResultList
- See Also:
KeyedPage
,KeyedResultList
-
setOptionalId
public void setOptionalId(Serializable id)
- Specified by:
setOptionalId
in interfaceQueryImplementor<R>
-
setOptionalEntityName
public void setOptionalEntityName(String entityName)
- Specified by:
setOptionalEntityName
in interfaceQueryImplementor<R>
-
setOptionalObject
public void setOptionalObject(Object optionalObject)
- Specified by:
setOptionalObject
in interfaceQueryImplementor<R>
-
-