Interface MutationOrSelectionQuery
- All Superinterfaces:
CommonQueryContract, Query, Query<Object>, StatementOrTypedQuery
StatementOrTypedQuery with Query, allowing backward
compatibility with older versions of Hibernate and JPA which did not carefully
distinguish selection queries from insert, update,
and delete mutation statements.
An instance of this interface is returned by
SharedSessionContract.createQuery(String) or
SharedSessionContract.createNamedQuery(String). But in newly written
code, this interface should not be used to directly execute a query or statement.
Instead:
- to obtain a
SelectionQuery, callofType(Class),asSelectionQuery(), orasSelectionQuery(Class), - to specify an entity graph, call
withEntityGraph(EntityGraph), - to specify a result set mapping, call
withResultSetMapping(ResultSetMapping), or - to obtain a
MutationQuery, callasStatement()orasMutationQuery().
A typical idiom is the following:
List<Book> matchingBooks =
session.createQuery("from Book where title like :titlePattern")
.ofType(Book.class)
.setParameter("titlePattern", pattern)
.setMaxResults(pageSize)
.setCacheStoreMode(CacheStoreMode.BYPASS)
.getResultList();
- Since:
- 8.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddQueryHint(String hint) Add a database query hint to the SQL query.Casts this query as a mutation query.Casts this query as aSelectionQuery.<X> SelectionQuery<X> asSelectionQuery(EntityGraph<X> entityGraph) Casts this query as aSelectionQuerywith the given result graph.<X> SelectionQuery<X> asSelectionQuery(EntityGraph<X> entityGraph, GraphSemantic graphSemantic) Overload of asSelectionQuery(EntityGraph) allowing a specific semantic (load/fetch) for the graph.<R> SelectionQuery<R> asSelectionQuery(Class<R> type) Casts this query as aSelectionQuerywith the given result type.disableFetchProfile(String profileName) Deprecated, for removal: This API element is subject to removal in a future version.enableFetchProfile(String profileName) Deprecated, for removal: This API element is subject to removal in a future version.intDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.booleanbooleanlist()Deprecated, for removal: This API element is subject to removal in a future version.<R> SelectionQuery<R> scroll()Deprecated, for removal: This API element is subject to removal in a future version.scroll(ScrollMode scrollMode) Deprecated, for removal: This API element is subject to removal in a future version.setCacheable(boolean cacheable) Deprecated, for removal: This API element is subject to removal in a future version.setCacheMode(CacheMode cacheMode) Deprecated, for removal: This API element is subject to removal in a future version.setCacheRegion(String cacheRegion) Deprecated, for removal: This API element is subject to removal in a future version.setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode) Deprecated, for removal: This API element is subject to removal in a future version.setCacheStoreMode(CacheStoreMode cacheStoreMode) Deprecated, for removal: This API element is subject to removal in a future version.setComment(String comment) Set the comment for this query.setConvertedParameter(int position, P value, Class<? extends AttributeConverter<P, ?>> converter) setConvertedParameter(String name, P value, Class<? extends AttributeConverter<P, ?>> converter) setEntityGraph(EntityGraph<? super Object> graph, GraphSemantic semantic) Deprecated, for removal: This API element is subject to removal in a future version.setFetchSize(int fetchSize) Deprecated, for removal: This API element is subject to removal in a future version.setFirstResult(int startPosition) Deprecated, for removal: This API element is subject to removal in a future version.setFlushMode(FlushModeType flushMode) Deprecated.setFollowOnStrategy(Locking.FollowOn followOnStrategy) Deprecated, for removal: This API element is subject to removal in a future version.setHibernateLockMode(LockMode lockMode) Deprecated, for removal: This API element is subject to removal in a future version.Set a hint.setLockMode(LockModeType lockMode) Deprecated, for removal: This API element is subject to removal in a future version.setMaxResults(int maxResults) Deprecated, for removal: This API element is subject to removal in a future version.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.setParameter(int position, P value, Type<P> type) Bind the given argument to an ordinal query parameter using the givenType.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.setParameter(Parameter<P> param, P 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.setParameter(String name, P value, Type<P> type) Bind the given argument to a named query parameter using the givenType.setParameter(String name, P value, Class<P> type) setParameter(QueryParameter<P> parameter, P value) Bind an argument to the query parameter represented by the givenQueryParameter.setParameter(QueryParameter<P> parameter, P val, Type<P> type) Bind an argument to the query parameter represented by the givenQueryParameter, using the givenType.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.setParameterList(int position, Object[] values) Bind multiple arguments to an ordinal query parameter.setParameterList(int position, Collection values) Bind multiple arguments to an ordinal query parameter.setParameterList(int position, Collection<? extends P> values, Type<P> type) Bind multiple arguments to an ordinal query parameter using the givenType.setParameterList(int position, Collection<? extends P> values, Class<P> javaType) setParameterList(int position, P[] values, Type<P> type) Bind multiple arguments to an ordinal query parameter using the givenType.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.setParameterList(String name, Collection<? extends P> values, Type<P> type) Bind multiple arguments to a named query parameter using the givenType.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).setParameterList(String name, P[] values, Type<P> type) Bind multiple arguments to a named query parameter using the givenType.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.setParameterList(QueryParameter<P> parameter, Collection<? extends P> values) Bind multiple arguments to the query parameter represented by the givenQueryParameter.setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Type<P> type) Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the givenType.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.setParameterList(QueryParameter<P> parameter, P[] values) Bind multiple arguments to the query parameter represented by the givenQueryParameter.setParameterList(QueryParameter<P> parameter, P[] values, Type<P> type) Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theType.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.setParameters(Object... arguments) 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) Deprecated.setReadOnly(boolean readOnly) Deprecated, for removal: This API element is subject to removal in a future version.setResultListTransformer(ResultListTransformer<Object> transformer) Deprecated, for removal: This API element is subject to removal in a future version.setTimeout(int timeout) Specify a JDBC query timeout to use when executing the query.setTimeout(Timeout timeout) Specify a JDBC query timeout to use when executing the query.setTimeout(Integer timeout) Specify a JDBC query timeout to use when executing the query.<X> Query<X> setTupleTransformer(TupleTransformer<X> transformer) Deprecated, for removal: This API element is subject to removal in a future version.stream()Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.<R> SelectionQuery<R> withEntityGraph(EntityGraph<R> graph) <R> SelectionQuery<R> withResultSetMapping(jakarta.persistence.sql.ResultSetMapping<R> mapping) Methods inherited from interface CommonQueryContract
getComment, getEffectiveFlushMode, getParameterMetadata, getQueryFlushMode, getSession, getTimeoutMethods inherited from interface Query
getHints, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrapMethods inherited from interface Query
getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getFetchSize, getFirstResult, getFlushMode, getHibernateLockMode, getLockMode, getMaxResults, getQueryOptions, getQueryString, isCacheable, isQueryPlanCacheable, isReadOnly
-
Method Details
-
isSelectionQuery
boolean isSelectionQuery() -
isMutationQuery
boolean isMutationQuery() -
asSelectionQuery
Casts this query as aSelectionQuery.- Throws:
IllegalSelectQueryException- If the query is not a select query.
-
asSelectionQuery
Casts this query as aSelectionQuerywith the given result type.- Throws:
IllegalSelectQueryException- If the query is not a select query.IllegalArgumentException- If the giventypeis not compatible with the query's defined result type.
-
asSelectionQuery
Casts this query as aSelectionQuerywith the given result graph.- Throws:
IllegalSelectQueryException- If the query is not a selection query.IllegalArgumentException- If the given graph result type is not compatible with theQuerytype parameter.
-
asSelectionQuery
@Nonnull <X> SelectionQuery<X> asSelectionQuery(EntityGraph<X> entityGraph, GraphSemantic graphSemantic) Overload of asSelectionQuery(EntityGraph) allowing a specific semantic (load/fetch) for the graph.- Parameters:
entityGraph- The entity graph.graphSemantic- The load/fetch semantic.- Returns:
- The cast/converted query.
- See Also:
-
asMutationQuery
Casts this query as a mutation query.- Throws:
IllegalMutationQueryException- If the query is not a mutation query.
-
ofType
- Specified by:
ofTypein interfaceStatementOrTypedQuery- Parameters:
resultType- The Java class of the query result type
-
withEntityGraph
- Specified by:
withEntityGraphin interfaceStatementOrTypedQuery- Parameters:
graph- The entity graph, interpreted as a load graph
-
withResultSetMapping
@Nonnull <R> SelectionQuery<R> withResultSetMapping(@Nonnull jakarta.persistence.sql.ResultSetMapping<R> mapping) - Specified by:
withResultSetMappingin interfaceStatementOrTypedQuery- Parameters:
mapping- The result set mapping
-
asStatement
- Specified by:
asStatementin interfaceStatementOrTypedQuery
-
setQueryFlushMode
Description copied from interface:QuerySet theQueryFlushModeto use for this query.A
QueryFlushModeonly affects stateful sessions. A stateless session has no persistence context to flush.- Specified by:
setQueryFlushModein interfaceCommonQueryContract- Specified by:
setQueryFlushModein interfaceQuery- Specified by:
setQueryFlushModein interfaceQuery<Object>- Specified by:
setQueryFlushModein interfaceStatementOrTypedQuery- See Also:
-
setQueryPlanCacheable
Deprecated.Description copied from interface:QueryEnable or disable query plan caching for this query, if available.- Specified by:
setQueryPlanCacheablein interfaceQuery<Object>- See Also:
-
addQueryHint
Description copied from interface:QueryAdd a database query hint to the SQL query.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:
addQueryHintin interfaceCommonQueryContract- Specified by:
addQueryHintin interfaceQuery<Object>
-
setTimeout
Description copied from interface:QuerySpecify a JDBC query timeout to use when executing the query.- Specified by:
setTimeoutin interfaceCommonQueryContract- Specified by:
setTimeoutin interfaceQuery<Object>- See Also:
-
setTimeout
Description copied from interface:QuerySpecify a JDBC query timeout to use when executing the query.- Specified by:
setTimeoutin interfaceCommonQueryContract- Specified by:
setTimeoutin interfaceQuery- Specified by:
setTimeoutin interfaceQuery<Object>- Specified by:
setTimeoutin interfaceStatementOrTypedQuery- See Also:
-
setTimeout
Description copied from interface:QuerySpecify a JDBC query timeout to use when executing the query.- Specified by:
setTimeoutin interfaceCommonQueryContract- Specified by:
setTimeoutin interfaceQuery- Specified by:
setTimeoutin interfaceQuery<Object>- Specified by:
setTimeoutin interfaceStatementOrTypedQuery
-
setComment
Description copied from interface:QuerySet the comment for this query.If SQL commenting is enabled, the comment will be added to the SQL query sent to the database, which may be useful for identifying the source of troublesome queries.
SQL commenting may be enabled using the configuration property "hibernate.use_sql_comments".
- Specified by:
setCommentin interfaceCommonQueryContract- Specified by:
setCommentin interfaceQuery<Object>- See Also:
-
setHint
Description copied from interface:QuerySet a hint. Hints are a JPA-standard way to control provider-specific behavior affecting execution of the query. Clients of this native Hibernate API should make use of type safe operations of this interface and of its subtypes. For example,SelectionQuery.setCacheRegion(String)is preferred overHibernateHints.HINT_CACHE_REGION.Since JPA 4,
TypedQuery.OptionandStatement.Optioncompete with query hints, offering a more type safe way to accommodate vendor extensions.The hints understood by Hibernate are enumerated by
AvailableHints.- Specified by:
setHintin interfaceCommonQueryContract- Specified by:
setHintin interfaceQuery- Specified by:
setHintin interfaceQuery<Object>- Specified by:
setHintin interfaceStatementOrTypedQuery- See Also:
-
setFlushMode
Deprecated.Description copied from interface:QuerySet theFlushModeTypeto use for this query.Setting this to
nullultimately indicates to use theFlushModeof the session. UseQuery.setQueryFlushMode(QueryFlushMode)passingQueryFlushMode.NO_FLUSHinstead to indicate that no automatic flushing should occur.- Specified by:
setFlushModein interfaceQuery- Specified by:
setFlushModein interfaceQuery<Object>- See Also:
-
setEntityGraph
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery setEntityGraph(@Nonnull EntityGraph<? super Object> graph, @Nonnull GraphSemantic semantic) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryApply anEntityGraphto the query.This is an alternative way to specify the associations which should be fetched as part of the initial query.
- Specified by:
setEntityGraphin interfaceQuery<Object>- See Also:
-
executeUpdate
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute an insert, update, or delete statement, and return the number of affected entities.For use with instances of
MutationQuerycreated usingSharedSessionContract.createMutationQuery(String),SharedSessionContract.createNamedMutationQuery(String),SharedSessionContract.createNativeMutationQuery(String), orSharedSessionContract.createMutationQuery(jakarta.persistence.criteria.CriteriaStatement).- Specified by:
executeUpdatein interfaceQuery- Specified by:
executeUpdatein interfaceQuery<Object>- Returns:
- the number of affected entity instances (may differ from the number of affected rows)
- See Also:
-
getResultList
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return theQuery<T>results as aList. If theQuery<T>contains multiple items in the selection list, then by default each result in the list is packaged in an array of typeObject[].- Specified by:
getResultListin interfaceQuery- Specified by:
getResultListin interfaceQuery<Object>- Returns:
- the results as a list
-
getSingleResult
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return the single result of the query, throwing an exception if theQuery<T>returns no results.- Specified by:
getSingleResultin interfaceQuery- Specified by:
getSingleResultin interfaceQuery<Object>- Returns:
- the single result, only if there is exactly one
-
getSingleResultOrNull
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return the single result of the query ornullif theQuery<T>returns no results, throwing and exception if theQuery<T>returns more than one result.- Specified by:
getSingleResultOrNullin interfaceQuery- Specified by:
getSingleResultOrNullin interfaceQuery<Object>- Returns:
- the single result, if there is exactly one result,
or
nullif there are no results to return
-
getResultStream
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return theQuery<T>results as aStream. If theQuery<T>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.- Specified by:
getResultStreamin interfaceQuery- Specified by:
getResultStreamin interfaceQuery<Object>- Returns:
- The results as a
Stream
-
list
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return theQuery<T>results as aList. If theQuery<T>contains multiple items in the selection list, then by default each result in the list is packaged in an array of typeObject[]. -
scroll
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return the results in a scrollable form.This overload simply calls
Query.scroll(ScrollMode)using the default scroll mode of the SQL dialect. -
scroll
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return the results in a scrollable form. The capabilities of the returnedScrollableResultsdepend on the specifiedScrollMode. -
stream
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return theQuery<T>results as aStream. If theQuery<T>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
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecute theQuery<T>and return the single result of the query, ornullif theQuery<T>returns no results.- Specified by:
uniqueResultin interfaceQuery<Object>- Returns:
- the single result or
nullif there is no result to return
-
uniqueResultOptional
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:Query- Specified by:
uniqueResultOptionalin interfaceQuery<Object>- Returns:
- the single result as an
Optional
-
setFetchSize
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySpecify a JDBC fetch size to use when executing this query.- Specified by:
setFetchSizein interfaceQuery<Object>- Parameters:
fetchSize- the fetch size hint- Returns:
this, for method chaining- See Also:
-
setReadOnly
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySet 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:
setReadOnlyin interfaceQuery<Object>- 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
-
setMaxResults
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setMaxResultsin interfaceQuery- Specified by:
setMaxResultsin interfaceQuery<Object>
-
setFirstResult
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setFirstResultin interfaceQuery- Specified by:
setFirstResultin interfaceQuery<Object>
-
setCacheMode
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery setCacheMode(@Nonnull CacheMode cacheMode) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySet the currentCacheModein effect for this query.Set it to
nullto indicate that theCacheModeof thesessionshould be used.- Specified by:
setCacheModein interfaceQuery<Object>- See Also:
-
setCacheStoreMode
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery setCacheStoreMode(@Nonnull CacheStoreMode cacheStoreMode) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setCacheStoreModein interfaceQuery- Specified by:
setCacheStoreModein interfaceQuery<Object>
-
setCacheRetrieveMode
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery setCacheRetrieveMode(@Nonnull CacheRetrieveMode cacheRetrieveMode) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setCacheRetrieveModein interfaceQuery- Specified by:
setCacheRetrieveModein interfaceQuery<Object>
-
setCacheRegion
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySet the name of the cache region where query results should be cached (assumingQuery.isCacheable()).nullindicates to use the default region.- Specified by:
setCacheRegionin interfaceQuery<Object>- See Also:
-
setLockMode
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery setLockMode(@Nonnull LockModeType lockMode) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setLockModein interfaceQuery- Specified by:
setLockModein interfaceQuery<Object>
-
setHibernateLockMode
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery setHibernateLockMode(@Nonnull LockMode lockMode) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:Query- Specified by:
setHibernateLockModein interfaceQuery<Object>- See Also:
-
setFollowOnStrategy
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery setFollowOnStrategy(@Nonnull Locking.FollowOn followOnStrategy) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryControl how Hibernate should handle cases where it is determined subsequent SQL queries would be needs to completely accomplish locking as requested.- Specified by:
setFollowOnStrategyin interfaceQuery<Object>- Parameters:
followOnStrategy- The strategy for follow-on locking.- Returns:
this, for method chaining
-
setCacheable
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryEnable/disable second level query (result) caching for this query.- Specified by:
setCacheablein interfaceQuery<Object>- See Also:
-
enableFetchProfile
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery enableFetchProfile(@Nonnull String profileName) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryEnable 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.
- Specified by:
enableFetchProfilein interfaceQuery<Object>- Parameters:
profileName- the name of the fetch profile to be enabled- See Also:
-
disableFetchProfile
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery disableFetchProfile(@Nonnull String profileName) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryDisable the fetch profile with the given name in this session. If the fetch profile is not currently enabled, the call has no effect.- Specified by:
disableFetchProfilein interfaceQuery<Object>- Parameters:
profileName- the name of the fetch profile to be disabled- See Also:
-
setResultListTransformer
@Deprecated(forRemoval=true) @Nonnull MutationOrSelectionQuery setResultListTransformer(@Nonnull ResultListTransformer<Object> transformer) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySet aResultListTransformer.- Specified by:
setResultListTransformerin interfaceQuery<Object>
-
setTupleTransformer
@Deprecated(forRemoval=true) @Nonnull <X> Query<X> setTupleTransformer(@Nonnull TupleTransformer<X> transformer) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySet aTupleTransformer.- Specified by:
setTupleTransformerin interfaceQuery<Object>
-
setParameter
@Nonnull <P> MutationOrSelectionQuery setParameter(@Nonnull String name, @Nullable P value, @Nonnull Class<P> type) Description copied from interface:QueryBind 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- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- Specified by:
setParameterin interfaceStatementOrTypedQuery- See Also:
-
setParameter
@Nonnull <P> MutationOrSelectionQuery setParameter(@Nonnull String name, @Nullable P value, @Nonnull Type<P> type) Description copied from interface:QueryBind the given argument to a named query parameter using the givenType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- Specified by:
setParameterin interfaceStatementOrTypedQuery
-
setParameter
Description copied from interface:QueryBind 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- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- Specified by:
setParameterin interfaceStatementOrTypedQuery- See Also:
-
setParameter
Description copied from interface:QueryBind 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- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- Specified by:
setParameterin interfaceStatementOrTypedQuery- See Also:
-
setParameters
Description copied from interface:Query- Specified by:
setParametersin interfaceCommonQueryContract- Specified by:
setParametersin interfaceQuery- Specified by:
setParametersin interfaceQuery<Object>- Specified by:
setParametersin interfaceStatementOrTypedQuery- See Also:
-
setParameter
@Nonnull <P> MutationOrSelectionQuery setParameter(int position, @Nullable P value, @Nonnull Class<P> type) Description copied from interface:QueryBind 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- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- Specified by:
setParameterin interfaceStatementOrTypedQuery- See Also:
-
setParameter
@Nonnull <P> MutationOrSelectionQuery setParameter(int position, @Nullable P value, @Nonnull Type<P> type) Description copied from interface:QueryBind the given argument to an ordinal query parameter using the givenType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- Specified by:
setParameterin interfaceStatementOrTypedQuery
-
setConvertedParameter
@Nonnull <P> MutationOrSelectionQuery setConvertedParameter(@Nonnull String name, @Nullable P value, @Nonnull Class<? extends AttributeConverter<P, ?>> converter) Description copied from interface:Query- Specified by:
setConvertedParameterin interfaceCommonQueryContract- Specified by:
setConvertedParameterin interfaceQuery- Specified by:
setConvertedParameterin interfaceQuery<Object>- Specified by:
setConvertedParameterin interfaceStatementOrTypedQuery- See Also:
-
setConvertedParameter
@Nonnull <P> MutationOrSelectionQuery setConvertedParameter(int position, @Nullable P value, @Nonnull Class<? extends AttributeConverter<P, ?>> converter) Description copied from interface:Query- Specified by:
setConvertedParameterin interfaceCommonQueryContract- Specified by:
setConvertedParameterin interfaceQuery- Specified by:
setConvertedParameterin interfaceQuery<Object>- Specified by:
setConvertedParameterin interfaceStatementOrTypedQuery- See Also:
-
setParameter
@Deprecated @Nonnull MutationOrSelectionQuery setParameter(@Nonnull String name, @Nullable Instant value, @Nonnull TemporalType temporalType) Deprecated.Description copied from interface:QueryBind anInstantvalue to the namedQuery<T>parameter using just the portion indicated by the givenTemporalType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery<Object>
-
setParameter
@Deprecated @Nonnull MutationOrSelectionQuery setParameter(@Nonnull String name, @Nullable Calendar value, @Nonnull TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- See Also:
-
setParameter
@Deprecated @Nonnull MutationOrSelectionQuery setParameter(@Nonnull String name, @Nullable Date value, @Nonnull TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- See Also:
-
setParameter
@Deprecated @Nonnull MutationOrSelectionQuery setParameter(int position, @Nullable Instant value, @Nonnull TemporalType temporalType) Deprecated.Description copied from interface:QueryBind anInstantvalue to the ordinalQuery<T>parameter using just the portion indicated by the givenTemporalType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery<Object>
-
setParameter
@Deprecated @Nonnull MutationOrSelectionQuery setParameter(int position, @Nullable Date value, @Nonnull TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- See Also:
-
setParameter
@Deprecated @Nonnull MutationOrSelectionQuery setParameter(int position, @Nullable Calendar value, @Nonnull TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- See Also:
-
setParameter
@Nonnull <P> MutationOrSelectionQuery setParameter(@Nonnull QueryParameter<P> parameter, @Nullable P value) Description copied from interface:QueryBind 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- Specified by:
setParameterin interfaceQuery<Object>- Parameters:
parameter- the query parameter mementovalue- the argument, which might be null- Returns:
this, for method chaining- See Also:
-
setParameter
@Nonnull <P> MutationOrSelectionQuery setParameter(@Nonnull QueryParameter<P> parameter, @Nullable P value, @Nonnull Class<P> type) Description copied from interface:QueryBind 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- Specified by:
setParameterin interfaceQuery<Object>- 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
@Nonnull <P> MutationOrSelectionQuery setParameter(@Nonnull QueryParameter<P> parameter, @Nullable P val, @Nonnull Type<P> type) Description copied from interface:QueryBind an argument to the query parameter represented by the givenQueryParameter, using the givenType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery<Object>- Parameters:
parameter- the query parameter mementoval- the argument, which might be nulltype- aTyperepresenting the type of the parameter- Returns:
this, for method chaining
-
setParameter
Description copied from interface:Query- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- Specified by:
setParameterin interfaceStatementOrTypedQuery- See Also:
-
setParameter
@Deprecated @Nonnull MutationOrSelectionQuery setParameter(@Nonnull Parameter<Calendar> param, @Nullable Calendar value, @Nonnull TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- See Also:
-
setParameter
@Deprecated @Nonnull MutationOrSelectionQuery setParameter(@Nonnull Parameter<Date> param, @Nullable Date value, @Nonnull TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<Object>- See Also:
-
setParameterList
@Nonnull MutationOrSelectionQuery setParameterList(@Nonnull String name, @Nonnull Collection values) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining- See Also:
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull String name, @Nonnull Collection<? extends P> values, @Nonnull Class<P> javaType) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining- See Also:
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull String name, @Nonnull Collection<? extends P> values, @Nonnull Type<P> type) Description copied from interface:QueryBind multiple arguments to a named query parameter using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull String name, @Nonnull P[] values, @Nonnull Class<P> javaType) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining- See Also:
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull String name, @Nonnull P[] values, @Nonnull Type<P> type) Description copied from interface:QueryBind multiple arguments to a named query parameter using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(int position, @Nonnull Collection<? extends P> values, @Nonnull Class<P> javaType) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining- See Also:
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(int position, @Nonnull Collection<? extends P> values, @Nonnull Type<P> type) Description copied from interface:QueryBind multiple arguments to an ordinal query parameter using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(int position, @Nonnull P[] values, @Nonnull Class<P> javaType) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining- See Also:
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(int position, @Nonnull P[] values, @Nonnull Type<P> type) Description copied from interface:QueryBind multiple arguments to an ordinal query parameter using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull QueryParameter<P> parameter, @Nonnull Collection<? extends P> values) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Parameters:
parameter- the parameter mementovalues- a collection of arguments- Returns:
this, for method chaining
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull QueryParameter<P> parameter, @Nonnull Collection<? extends P> values, @Nonnull Class<P> javaType) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining- See Also:
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull QueryParameter<P> parameter, @Nonnull Collection<? extends P> values, @Nonnull Type<P> type) Description copied from interface:QueryBind multiple arguments to the query parameter represented by the givenQueryParameter, using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull QueryParameter<P> parameter, @Nonnull P[] values) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Parameters:
parameter- the parameter mementovalues- a collection of arguments- Returns:
this, for method chaining
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull QueryParameter<P> parameter, @Nonnull P[] values, @Nonnull Class<P> javaType) Description copied from interface:QueryBind 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- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining- See Also:
-
setParameterList
@Nonnull <P> MutationOrSelectionQuery setParameterList(@Nonnull QueryParameter<P> parameter, @Nonnull P[] values, @Nonnull Type<P> type) Description copied from interface:QueryBind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceQuery<Object>- Returns:
this, for method chaining
-
setProperties
Description copied from interface:QueryBind 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- Specified by:
setPropertiesin interfaceQuery<Object>- Parameters:
bean- any JavaBean or POJO- Returns:
this, for method chaining
-
setProperties
Description copied from interface:QueryBind 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- Specified by:
setPropertiesin interfaceQuery<Object>- Parameters:
bean- aMapof names to arguments- Returns:
this, for method chaining
-