Interface SelectionQuery<R>
- All Superinterfaces:
CommonQueryContract
- All Known Subinterfaces:
NativeQuery<T>, NativeQueryImplementor<R>, ProcedureCallImplementor<R>, Query<R>, QueryImplementor<R>, SqmQueryImplementor<R>, SqmSelectionQuery<R>, SqmSelectionQueryImplementor<R>
- All Known Implementing Classes:
AbstractQuery, AbstractSelectionQuery, DelegatingSqmSelectionQueryImplementor
select. It is a slimmed-down version of Query, providing
only methods relevant to selection queries.
A SelectionQuery may be obtained from the Session
by calling:
QueryProducer.createSelectionQuery(String, Class), passing the HQL as a string,QueryProducer.createSelectionQuery(jakarta.persistence.criteria.CriteriaQuery), passing a criteria query object, orQueryProducer.createNamedSelectionQuery(String, Class)passing the name of a query defined usingNamedQueryorNamedNativeQuery.
A SelectionQuery controls how a query is executed, and allows arguments
to be bound to its parameters.
- Selection queries are usually executed using
getResultList()orgetSingleResult(). - The methods
setMaxResults(int)andsetFirstResult(int)control limits and pagination. - The various overloads of
setParameter(String, Object)andsetParameter(int, Object)allow arguments to be bound to named and ordinal parameters defined by the query.
getResultList():
List<Book> books =
session.createSelectionQuery("from Book left join fetch authors where title like :title")
.setParameter("title", title)
.setMaxResults(50)
.getResultList();
A query which is expected to return exactly one on result should be executed
via getSingleResult(), or, if it might not return a result,
getSingleResultOrNull():
Book book =
session.createSelectionQuery("from Book where isbn = ?1")
.setParameter(1, isbn)
.getSingleResultOrNull();
A query may have explicit fetch joins, specified using the syntax
join fetch in HQL, or via FetchParent.fetch(SingularAttribute)
in the criteria API. Additional fetch joins may be added by:
- setting an
EntityGraphby callingsetEntityGraph(EntityGraph, GraphSemantic), or - enabling a fetch profile, using
Session.enableFetchProfile(String).
The special built-in fetch profile named
"org.hibernate.defaultProfile"
adds a fetch join for every eager
@ManyToOne or @OneToOne association belonging to an entity
returned by the query.
Finally, three alternative approaches to pagination are available:
-
The ancient but dependable operations
setFirstResult(int)andsetMaxResults(int)are the standard approach blessed by the JPA specification. -
SelectionSpecificationandsetPage(Page), together withOrderandPage, provide a streamlined API for offset-based pagination, at a slightly higher semantic level. -
On the other hand,
KeyedPageandKeyedResultList, along withgetKeyedResultList(KeyedPage), provide for key-based pagination, which can help eliminate missed or duplicate results when data is modified between page requests.
-
Method Summary
Modifier and TypeMethodDescriptiondisableFetchProfile(String profileName) Disable the fetch profile with the given name in this session.enableFetchProfile(String profileName) Enable the fetch profile with the given name during execution of this query.Obtain theCacheModein effect for this query.Obtain the name of the second level query cache region in which query results will be stored (if they are cached, see the discussion onisCacheable()for more information).Obtain the JDBC fetch size hint in effect for this query.intThe first query result row to return.Get the rootLockModefor the querygetKeyedResultList(KeyedPage<R> page) Execute the query and return the results for the given page, using key-based pagination.Get the rootLockModeTypefor the queryDeprecated, for removal: This API element is subject to removal in a future version.intThe maximum number of query result rows to return.longDetermine the size of the query result list that would be returned by callinggetResultList()with no offset or limit applied to the query.Execute the query and return the query results as aList.Execute the query and return the query results as aStream.Execute the query and return the single result of the query, throwing an exception if the query returns no results.Execute the query and return the single result of the query, ornullif the query returns no results.booleanShould the results of the query be stored in the second level cache?booleanShould the query plan of the query be stored in the query plan cache?booleanShould entities and proxies loaded by this Query be put in read-only mode? If the read-only/modifiable setting was not initialized, then the default read-only/modifiable setting for the persistence context i s returned instead.list()Execute the query and return the query results as aList.scroll()Returns scrollable access to the query results, using the default scroll mode of the SQL dialect.scroll(ScrollMode scrollMode) Returns scrollable access to the query results.setCacheable(boolean cacheable) Enable/disable second level query (result) caching for this query.setCacheMode(CacheMode cacheMode) Set the currentCacheModein effect for this query.setCacheRegion(String cacheRegion) Set the name of the cache region where query results should be cached (assumingisCacheable()).setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode) setCacheStoreMode(CacheStoreMode cacheStoreMode) setComment(String comment) Set a comment for this query.setEntityGraph(EntityGraph<? super R> graph, GraphSemantic semantic) Apply anEntityGraphto the query.setFetchSize(int fetchSize) Sets a JDBC fetch size hint for the query.setFirstResult(int startPosition) Set the first query result row to return.setFlushMode(FlushModeType flushMode) Deprecated.setFollowOnLocking(boolean enable) Deprecated.Use setFollowOnStrategy(Locking.FollowOn) insteadsetFollowOnStrategy(Locking.FollowOn followOnStrategy) Specifies whether follow-on locking should be appliedsetHibernateFlushMode(FlushMode flushMode) Deprecated.setHibernateLockMode(LockMode lockMode) Specify the rootLockModefor the querySet a hint.setLockMode(LockModeType lockMode) Specify the rootLockModeTypefor the querysetLockMode(String alias, LockMode lockMode) Deprecated.Use setLockScope(Locking.Scope) instead.setLockScope(PessimisticLockScope lockScope) Deprecated.Use setLockScope(Locking.Scope) instead.setLockScope(Locking.Scope lockScope) Apply a scope to any pessimistic locking applied to the query.setMaxResults(int maxResults) Set the maximum number of query result rows to return.Set the page of results to return.setParameter(int position, Object value) Bind the given argument to an ordinal query parameter.setParameter(int position, Instant value, TemporalType temporalType) Deprecated.setParameter(int position, Calendar value, TemporalType temporalType) Deprecated.setParameter(int position, Date value, TemporalType temporalType) Deprecated.<P> SelectionQuery<R> setParameter(int position, P value, Type<P> type) Bind the given argument to an ordinal query parameter using the givenType.<P> SelectionQuery<R> setParameter(int position, P value, Class<P> type) setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) Deprecated.setParameter(Parameter<Date> param, Date value, TemporalType temporalType) Deprecated.<T> SelectionQuery<R> setParameter(Parameter<T> param, T value) setParameter(String name, Object value) Bind the given argument to a named query parameter.setParameter(String name, Instant value, TemporalType temporalType) Deprecated.setParameter(String name, Calendar value, TemporalType temporalType) Deprecated.setParameter(String name, Date value, TemporalType temporalType) Deprecated.<P> SelectionQuery<R> setParameter(String name, P value, Type<P> type) Bind the given argument to a named query parameter using the givenType.<P> SelectionQuery<R> setParameter(String name, P value, Class<P> type) <P> SelectionQuery<R> setParameter(QueryParameter<P> parameter, P val, Type<P> type) Bind an argument to the query parameter represented by the givenQueryParameter, using the givenType.<P> SelectionQuery<R> 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 theTypeto use.<T> SelectionQuery<R> setParameter(QueryParameter<T> parameter, T value) Bind an argument to the query parameter represented by the givenQueryParameter.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.<P> SelectionQuery<R> setParameterList(int position, Collection<? extends P> values, Type<P> type) Bind multiple arguments to an ordinal query parameter using the givenType.<P> SelectionQuery<R> setParameterList(int position, Collection<? extends P> values, Class<P> javaType) <P> SelectionQuery<R> setParameterList(int position, P[] values, Type<P> type) Bind multiple arguments to an ordinal query parameter using the givenType.<P> SelectionQuery<R> setParameterList(int position, P[] values, Class<P> javaType) 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.<P> SelectionQuery<R> setParameterList(String name, Collection<? extends P> values, Type<P> type) Bind multiple arguments to a named query parameter using the givenType.<P> SelectionQuery<R> 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 theTypeIf unable to infer an appropriateType, fall back toCommonQueryContract.setParameterList(String, Collection).<P> SelectionQuery<R> setParameterList(String name, P[] values, Type<P> type) Bind multiple arguments to a named query parameter using the givenType.<P> SelectionQuery<R> 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 theTypeto use.<P> SelectionQuery<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values) Bind multiple arguments to the query parameter represented by the givenQueryParameter.<P> SelectionQuery<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Type<P> type) Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the givenType.<P> SelectionQuery<R> 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 theTypeto use.<P> SelectionQuery<R> setParameterList(QueryParameter<P> parameter, P[] values) Bind multiple arguments to the query parameter represented by the givenQueryParameter.<P> SelectionQuery<R> setParameterList(QueryParameter<P> parameter, P[] values, Type<P> type) Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theType.<P> SelectionQuery<R> 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 theTypeto use.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 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.setQueryFlushMode(QueryFlushMode queryFlushMode) Set theQueryFlushModeto use for this query.setQueryPlanCacheable(boolean queryPlanCacheable) Enable/disable query plan caching for this query.setReadOnly(boolean readOnly) Set the read-only/modifiable mode for entities and proxies loaded by thisQuery.setResultListTransformer(ResultListTransformer<R> transformer) Set aResultListTransformer.setTimeout(int timeout) Set the query timeout in seconds.<T> SelectionQuery<T> setTupleTransformer(TupleTransformer<T> transformer) Set aTupleTransformer.stream()Execute the query and return the query results as aStream.Execute the query and return the single result of the query, ornullif the query returns no results.Execute the query and return the single result of the query, as anOptional.Methods inherited from interface CommonQueryContract
getComment, getFlushMode, getHibernateFlushMode, getParameterMetadata, getQueryFlushMode, getTimeout, setTimeout
-
Method Details
-
list
-
getResultList
-
scroll
ScrollableResults<R> scroll()Returns scrollable access to the query results, using the default scroll mode of the SQL dialect.- See Also:
-
scroll
Returns scrollable access to the query results. The capabilities of the returnedScrollableResultsdepend on the specifiedScrollMode. -
getResultStream
Execute the query and return the query results as aStream. If the query contains multiple items in the selection list, then by default each result in the stream is packaged in an array of typeObject[].The client should call
BaseStream.close()after processing the stream so that resources are freed as soon as possible. -
stream
Execute the query and return the query results as aStream. If the query contains multiple items in the selection list, then by default each result in the stream is packaged in an array of typeObject[].The client should call
BaseStream.close()after processing the stream so that resources are freed as soon as possible. -
uniqueResult
R uniqueResult()Execute the query and return the single result of the query, ornullif the query returns no results.- Returns:
- the single result or
null - Throws:
NonUniqueResultException- if there is more than one matching result
-
getSingleResult
R getSingleResult()Execute the query and return the single result of the query, throwing an exception if the query returns no results.- Returns:
- the single result, only if there is exactly one
- Throws:
NonUniqueResultException- if there is more than one matching resultNoResultException- if there is no result to return
-
getSingleResultOrNull
R getSingleResultOrNull()Execute the query and return the single result of the query, ornullif the query returns no results.- Returns:
- the single result or
nullif there is no result to return - Throws:
NonUniqueResultException- if there is more than one matching result- Since:
- 6.0
-
uniqueResultOptional
Execute the query and return the single result of the query, as anOptional.- Returns:
- the single result as an
Optional - Throws:
NonUniqueResultException- if there is more than one matching result
-
getResultCount
Determine the size of the query result list that would be returned by callinggetResultList()with no offset or limit applied to the query.- Returns:
- the size of the list that would be returned
- Since:
- 6.5
-
getKeyedResultList
Execute the query and return the results for the given page, using key-based pagination.- Parameters:
page- 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 - Since:
- 6.5
- See Also:
-
setHint
Description copied from interface:CommonQueryContractSet a hint. The hints understood by Hibernate are enumerated byAvailableHints.- Specified by:
setHintin interfaceCommonQueryContract- See Also:
-
setEntityGraph
Apply anEntityGraphto the query.This is an alternative way to specify the associations which should be fetched as part of the initial query.
- Since:
- 6.3
-
enableFetchProfile
Enable the fetch profile with the given name during execution of 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.
- Parameters:
profileName- the name of the fetch profile to be enabled- Throws:
UnknownProfileException- Indicates that the given name does not match any known fetch profile names- See Also:
-
disableFetchProfile
Disable the fetch profile with the given name in this session. If the fetch profile is not currently enabled, the call has no effect.- Parameters:
profileName- the name of the fetch profile to be disabled- Throws:
UnknownProfileException- Indicates that the given name does not match any known fetch profile names- See Also:
-
setFlushMode
Deprecated.Description copied from interface:CommonQueryContractSet theFlushModeto use for this query.Setting this to
nullultimately indicates to use theFlushModeof the session. UseCommonQueryContract.setHibernateFlushMode(FlushMode)passingFlushMode.MANUALinstead to indicate that no automatic flushing should occur.- Specified by:
setFlushModein interfaceCommonQueryContract- See Also:
-
setHibernateFlushMode
Deprecated.Description copied from interface:CommonQueryContractSet the currentFlushModein effect for this query.- Specified by:
setHibernateFlushModein interfaceCommonQueryContract- See Also:
-
setQueryFlushMode
Description copied from interface:CommonQueryContractSet theQueryFlushModeto use for this query.- Specified by:
setQueryFlushModein 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, although certain "magic values" are handled - see Timeouts.NO_WAIT.
A value of zero indicates no timeout.
- Specified by:
setTimeoutin interfaceCommonQueryContract- Parameters:
timeout- the timeout in seconds- Returns:
this, for method chaining- See Also:
-
setComment
Description copied from interface:CommonQueryContractSet a comment for this query.- Specified by:
setCommentin interfaceCommonQueryContract- See Also:
-
getFetchSize
Integer getFetchSize()Obtain the JDBC fetch size hint in effect for this query. This value is eventually passed along to the JDBC query viaStatement.setFetchSize(int). As defined by JDBC, this value is a hint to the driver to indicate how many rows to fetch from the database when more rows are needed.- Returns:
- The timeout in seconds
- See Also:
- Implementation Note:
- JDBC expressly defines this value as a hint. Depending on the driver, it may or may not have any
effect on the actual query execution and
ResultSetprocessing .
-
setFetchSize
Sets a JDBC fetch size hint for the query.- Parameters:
fetchSize- the fetch size hint- Returns:
this, for method chaining- See Also:
-
isReadOnly
boolean isReadOnly()Should entities and proxies loaded by this Query be put in read-only mode? If the read-only/modifiable setting was not initialized, then the default read-only/modifiable setting for the persistence context i s returned instead.- Returns:
trueif the entities and proxies loaded by the query will be put in read-only mode;falseotherwise (they will be modifiable)- See Also:
-
setReadOnly
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.
- Parameters:
readOnly-trueindicates that entities and proxies loaded by the query are to be put in read-only mode;falseindicates that entities and proxies loaded by the query will be put in modifiable mode- Returns:
this, for method chaining
-
getMaxResults
int getMaxResults()The maximum number of query result rows to return.- Returns:
- the maximum length of the query result list
-
setMaxResults
Set the maximum number of query result rows to return.- Parameters:
maxResults- the maximum length of the query result list
-
getFirstResult
int getFirstResult()The first query result row to return. The very first row of the query result list is considered the zeroth row.- Returns:
- the position of the first row to return, indexed from zero
-
setFirstResult
Set the first query result row to return. The very first row of the query result list is considered the zeroth row.- Parameters:
startPosition- the position of the first row to return, indexed from zero
-
setPage
Set the page of results to return.- Since:
- 6.3
- See Also:
-
getCacheMode
CacheMode getCacheMode()Obtain theCacheModein effect for this query. By default, the query inherits theCacheModeof the session from which it originates.The
CacheModehere affects the use of entity and collection caches as the query result set is processed. For caching of the actual query results, useisCacheable()andgetCacheRegion().In order for this setting to have any affect, second-level caching must be enabled and the entities and collections must be eligible for storage in the second-level cache.
- See Also:
-
getCacheStoreMode
CacheStoreMode getCacheStoreMode()- Since:
- 6.2
- See Also:
-
getCacheRetrieveMode
CacheRetrieveMode getCacheRetrieveMode()- Since:
- 6.2
- See Also:
-
setCacheMode
-
setCacheStoreMode
- Since:
- 6.2
- See Also:
-
setCacheRetrieveMode
- Since:
- 6.2
- See Also:
-
isCacheable
boolean isCacheable()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
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
SessionFactoryfor this to happen. Usually that is controlled by the configuration setting "hibernate.cache.use_query_cache". -
setCacheable
Enable/disable second level query (result) caching for this query.- See Also:
-
isQueryPlanCacheable
boolean isQueryPlanCacheable()Should the query plan of the query be stored in the query plan cache? -
setQueryPlanCacheable
Enable/disable query plan caching for this query.- See Also:
-
getCacheRegion
String getCacheRegion()Obtain the name of the second level query cache region in which query results will be stored (if they are cached, see the discussion onisCacheable()for more information).nullindicates that the default region should be used. -
setCacheRegion
Set the name of the cache region where query results should be cached (assumingisCacheable()).nullindicates to use the default region.- See Also:
-
getLockOptions
Deprecated, for removal: This API element is subject to removal in a future version.SinceLockOptionsis transitioning to a new role as an SPI.TheLockOptionscurrently in effect for the query -
getLockMode
-
setLockMode
Specify the rootLockModeTypefor the query- See Also:
-
getHibernateLockMode
-
setHibernateLockMode
Specify the rootLockModefor the query- See Also:
-
setLockScope
Apply a scope to any pessimistic locking applied to the query.- Parameters:
lockScope- The lock scope to apply- Returns:
this, for method chaining
-
setLockScope
Deprecated.Use setLockScope(Locking.Scope) instead.Apply a scope to any pessimistic locking applied to the query.- Parameters:
lockScope- The lock scope to apply- Returns:
this, for method chaining
-
setLockMode
Deprecated.Use setLockScope(Locking.Scope) instead.Specify aLockModeto apply to a specific alias defined in the query- See Also:
-
setFollowOnStrategy
Specifies whether follow-on locking should be applied -
setFollowOnLocking
Deprecated.Use setFollowOnStrategy(Locking.FollowOn) insteadSpecifies whether follow-on locking should be applied -
setTupleTransformer
Set aTupleTransformer. -
setResultListTransformer
Set aResultListTransformer. -
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 overloads which accepts a "type", or pass a
TypedParameterValue.- 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 theType. If unable to infer an appropriateType, 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 givenType.- Specified by:
setParameterin interfaceCommonQueryContract
-
setParameter
Deprecated.Description copied from interface:CommonQueryContractBind anInstantto the named query parameter using just the portion indicated by the givenTemporalType.- Specified by:
setParameterin interfaceCommonQueryContract
-
setParameter
Deprecated.- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
Deprecated.- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
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 overloads which accepts a "type", or pass a
TypedParameterValue.- 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 theType. If unable to infer an appropriateType, 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 givenType.- Specified by:
setParameterin interfaceCommonQueryContract
-
setParameter
Deprecated.Description copied from interface:CommonQueryContractBind anInstantto an ordinal query parameter using just the portion indicated by the givenTemporalType.- Specified by:
setParameterin interfaceCommonQueryContract
-
setParameter
Deprecated.- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
Deprecated.- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
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 overloads 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
Description copied from interface:CommonQueryContractBind an argument to the query parameter represented by the givenQueryParameter, using the givenClassreference to attempt to infer theTypeto use. If unable to infer an appropriateType, fall back toCommonQueryContract.setParameter(QueryParameter, Object).- Specified by:
setParameterin interfaceCommonQueryContract- Parameters:
parameter- the query parameter mementovalue- the argument, which might be nulltype- aTyperepresenting the type of the parameter- Returns:
this, for method chaining- See Also:
-
setParameter
Description copied from interface:CommonQueryContractBind an argument to the query parameter represented by the givenQueryParameter, using the givenType.- Specified by:
setParameterin interfaceCommonQueryContract- Parameters:
parameter- the query parameter mementoval- the argument, which might be nulltype- aTyperepresenting the type of the parameter- Returns:
this, for method chaining
-
setParameter
- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
@Deprecated SelectionQuery<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) Deprecated.- Specified by:
setParameterin interfaceCommonQueryContract- See Also:
-
setParameter
@Deprecated SelectionQuery<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType) Deprecated.- 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
<P> SelectionQuery<R> 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 theTypeIf unable to infer an appropriateType, 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 a named query parameter using the givenType.- 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 theTypeto use. If unable to determine an appropriateType,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 givenType.- 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
<P> SelectionQuery<R> 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 theType. If unable to infer an appropriateType, 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 givenType.- 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 theType. If unable to infer an appropriateType, 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 givenType.- 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 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
<P> SelectionQuery<R> 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 theTypeto use. If unable to infer an appropriateType, fall back to usingCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
<P> SelectionQuery<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Type<P> type) Description copied from interface:CommonQueryContractBind multiple arguments to the query parameter represented by the givenQueryParameter, using the givenType.- 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
Description copied from interface:CommonQueryContractBind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theTypeto use. If unable to infer an appropriateType, fall back to usingCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:CommonQueryContractBind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theType.- Specified by:
setParameterListin interfaceCommonQueryContract- Returns:
this, for method chaining
-
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
-
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:
bean- aMapof names to arguments- Returns:
this, for method chaining
-
LockOptionsis transitioning to a new role as an SPI.