Class StageQueryImpl<R>
- java.lang.Object
-
- org.hibernate.reactive.stage.impl.StageQueryImpl<R>
-
- All Implemented Interfaces:
Stage.AbstractQuery
,Stage.MutationQuery
,Stage.Query<R>
,Stage.SelectionQuery<R>
public class StageQueryImpl<R> extends java.lang.Object implements Stage.Query<R>
-
-
Constructor Summary
Constructors Constructor Description StageQueryImpl(ReactiveQuery<R> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stage.SelectionQuery<R>
enableFetchProfile(java.lang.String profileName)
Enable a fetch profile which will be in effect during execution of this query.java.util.concurrent.CompletionStage<java.lang.Integer>
executeUpdate()
Asynchronously execute this delete, update, or insert query, returning the updated row count.org.hibernate.CacheMode
getCacheMode()
Obtain theCacheMode
in effect for this query.java.lang.String
getCacheRegion()
jakarta.persistence.CacheRetrieveMode
getCacheRetrieveMode()
jakarta.persistence.CacheStoreMode
getCacheStoreMode()
java.lang.String
getComment()
int
getFirstResult()
org.hibernate.FlushMode
getFlushMode()
Obtain theFlushMode
in effect for this query.int
getMaxResults()
java.util.concurrent.CompletionStage<java.util.List<R>>
getResultList()
Asynchronously execute this query, returning the query results as aList
, via aCompletionStage
.java.util.concurrent.CompletionStage<R>
getSingleResult()
Asynchronously execute this query, returning a single row that matches the query, throwing an exception if the query returns zero rows or more than one matching row.java.util.concurrent.CompletionStage<R>
getSingleResultOrNull()
Asynchronously execute this query, returning a single row that matches the query, ornull
if the query returns no results, throwing an exception if the query returns more than one matching row.boolean
isCacheable()
boolean
isReadOnly()
Stage.Query<R>
setCacheable(boolean cacheable)
Enable or disable caching of this query result set in the second-level query cache.Stage.Query<R>
setCacheMode(org.hibernate.CacheMode cacheMode)
Set the currentCacheMode
in effect while this query is being executed.Stage.Query<R>
setCacheRegion(java.lang.String cacheRegion)
Set the name of the cache region in which to store this query result set ifcaching is enabled
.Stage.Query<R>
setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode)
Set the currentCacheRetrieveMode
in effect while this query is being executed.Stage.Query<R>
setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode)
Set the currentCacheStoreMode
in effect while this query is being executed.Stage.Query<R>
setComment(java.lang.String comment)
Set the comment for this query.Stage.Query<R>
setFirstResult(int startPosition)
Set the position of the first result that may be returned by this query when executed, where the results are numbered from 0.Stage.Query<R>
setFlushMode(jakarta.persistence.FlushModeType flushMode)
Set the currentFlushModeType
in effect while this query is being executed.Stage.Query<R>
setFlushMode(org.hibernate.FlushMode flushMode)
Set the currentFlushMode
in effect while this query is being executed.Stage.Query<R>
setLockMode(jakarta.persistence.LockModeType lockMode)
Set theLockModeType
to use for the whole query.Stage.Query<R>
setLockMode(java.lang.String alias, org.hibernate.LockMode lockMode)
Set theLockMode
to use for specified alias (as defined in the query'sfrom
clause).Stage.Query<R>
setLockMode(org.hibernate.LockMode lockMode)
Set theLockMode
to use for the whole query.Stage.Query<R>
setMaxResults(int maxResult)
Set the maximum number of results that may be returned by this query when executed.Stage.SelectionQuery<R>
setPage(org.hibernate.query.Page page)
Set the page of results to return.Stage.Query<R>
setParameter(int position, java.lang.Object value)
Set the value of an ordinal parameter.<T1> Stage.Query<R>
setParameter(jakarta.persistence.Parameter<T1> param, T1 value)
Set the value of a typed parameter.Stage.Query<R>
setParameter(java.lang.String name, java.lang.Object value)
Set the value of a named parameter.Stage.Query<R>
setPlan(jakarta.persistence.EntityGraph<R> entityGraph)
Set theEntityGraph
that will be used as a fetch plan for the root entity returned by this query.Stage.Query<R>
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies loaded by this Query.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.reactive.stage.Stage.Query
setLockMode
-
-
-
-
Constructor Detail
-
StageQueryImpl
public StageQueryImpl(ReactiveQuery<R> delegate)
-
-
Method Detail
-
getMaxResults
public int getMaxResults()
- Specified by:
getMaxResults
in interfaceStage.SelectionQuery<R>
- Returns:
- the maximum number results, or
Integer.MAX_VALUE
if not set
-
getResultList
public java.util.concurrent.CompletionStage<java.util.List<R>> getResultList()
Description copied from interface:Stage.SelectionQuery
Asynchronously execute this query, returning the query results as aList
, via aCompletionStage
. If the query has multiple results per row, the results are returned in an instance ofObject[]
.- Specified by:
getResultList
in interfaceStage.SelectionQuery<R>
- Returns:
- the resulting rows as a
List
- See Also:
Query.getResultList()
-
getFlushMode
public org.hibernate.FlushMode getFlushMode()
Description copied from interface:Stage.SelectionQuery
Obtain theFlushMode
in effect for this query. By default, the query inherits theFlushMode
of theStage.Session
from which is originates.- Specified by:
getFlushMode
in interfaceStage.SelectionQuery<R>
- See Also:
Stage.Session.getFlushMode()
-
setFlushMode
public Stage.Query<R> setFlushMode(org.hibernate.FlushMode flushMode)
Description copied from interface:Stage.SelectionQuery
Set the currentFlushMode
in effect while this query is being executed.- Specified by:
setFlushMode
in interfaceStage.Query<R>
- Specified by:
setFlushMode
in interfaceStage.SelectionQuery<R>
-
setLockMode
public Stage.Query<R> setLockMode(org.hibernate.LockMode lockMode)
Description copied from interface:Stage.SelectionQuery
Set theLockMode
to use for the whole query.- Specified by:
setLockMode
in interfaceStage.Query<R>
- Specified by:
setLockMode
in interfaceStage.SelectionQuery<R>
-
setPlan
public Stage.Query<R> setPlan(jakarta.persistence.EntityGraph<R> entityGraph)
Description copied from interface:Stage.SelectionQuery
Set theEntityGraph
that will be used as a fetch plan for the root entity returned by this query.- Specified by:
setPlan
in interfaceStage.Query<R>
- Specified by:
setPlan
in interfaceStage.SelectionQuery<R>
-
enableFetchProfile
public Stage.SelectionQuery<R> enableFetchProfile(java.lang.String profileName)
Description copied from interface:Stage.SelectionQuery
Enable a fetch profile which will be in effect during execution of this query.- Specified by:
enableFetchProfile
in interfaceStage.SelectionQuery<R>
-
getSingleResult
public java.util.concurrent.CompletionStage<R> getSingleResult()
Description copied from interface:Stage.SelectionQuery
Asynchronously execute this query, returning a single row that matches the query, throwing an exception if the query returns zero rows or more than one matching row. If the query has multiple results per row, the results are returned in an instance ofObject[]
.- Specified by:
getSingleResult
in interfaceStage.SelectionQuery<R>
- Returns:
- the single resulting row
- See Also:
Query.getSingleResult()
-
getSingleResultOrNull
public java.util.concurrent.CompletionStage<R> getSingleResultOrNull()
Description copied from interface:Stage.SelectionQuery
Asynchronously execute this query, returning a single row that matches the query, ornull
if the query returns no results, throwing an exception if the query returns more than one matching row. If the query has multiple results per row, the results are returned in an instance ofObject[]
.- Specified by:
getSingleResultOrNull
in interfaceStage.SelectionQuery<R>
- Returns:
- the single resulting row or
null
- See Also:
Stage.SelectionQuery.getSingleResult()
-
setFlushMode
public Stage.Query<R> setFlushMode(jakarta.persistence.FlushModeType flushMode)
Description copied from interface:Stage.SelectionQuery
Set the currentFlushModeType
in effect while this query is being executed.- Specified by:
setFlushMode
in interfaceStage.Query<R>
- Specified by:
setFlushMode
in interfaceStage.SelectionQuery<R>
-
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnly
in interfaceStage.SelectionQuery<R>
- Returns:
- the read-only/modifiable mode
- See Also:
Stage.Session.isDefaultReadOnly()
-
setReadOnly
public Stage.Query<R> setReadOnly(boolean readOnly)
Description copied from interface:Stage.SelectionQuery
Set the read-only/modifiable mode for entities and proxies loaded by this Query. This setting overrides the default setting for the persistence context.- Specified by:
setReadOnly
in interfaceStage.Query<R>
- Specified by:
setReadOnly
in interfaceStage.SelectionQuery<R>
- See Also:
Stage.Session.setDefaultReadOnly(boolean)
-
setMaxResults
public Stage.Query<R> setMaxResults(int maxResult)
Description copied from interface:Stage.SelectionQuery
Set the maximum number of results that may be returned by this query when executed.- Specified by:
setMaxResults
in interfaceStage.Query<R>
- Specified by:
setMaxResults
in interfaceStage.SelectionQuery<R>
-
getFirstResult
public int getFirstResult()
- Specified by:
getFirstResult
in interfaceStage.SelectionQuery<R>
- Returns:
- the first result, or 0 if not set
-
setFirstResult
public Stage.Query<R> setFirstResult(int startPosition)
Description copied from interface:Stage.SelectionQuery
Set the position of the first result that may be returned by this query when executed, where the results are numbered from 0.- Specified by:
setFirstResult
in interfaceStage.Query<R>
- Specified by:
setFirstResult
in interfaceStage.SelectionQuery<R>
-
setPage
public Stage.SelectionQuery<R> setPage(org.hibernate.query.Page page)
Description copied from interface:Stage.SelectionQuery
Set the page of results to return.- Specified by:
setPage
in interfaceStage.SelectionQuery<R>
- See Also:
Page
-
getCacheMode
public org.hibernate.CacheMode getCacheMode()
Description copied from interface:Stage.SelectionQuery
Obtain theCacheMode
in effect for this query. By default, the query inherits theCacheMode
of theStage.Session
from which is originates.- Specified by:
getCacheMode
in interfaceStage.SelectionQuery<R>
- See Also:
Stage.Session.getCacheMode()
-
getCacheStoreMode
public jakarta.persistence.CacheStoreMode getCacheStoreMode()
- Specified by:
getCacheStoreMode
in interfaceStage.SelectionQuery<R>
-
getCacheRetrieveMode
public jakarta.persistence.CacheRetrieveMode getCacheRetrieveMode()
- Specified by:
getCacheRetrieveMode
in interfaceStage.SelectionQuery<R>
-
setCacheMode
public Stage.Query<R> setCacheMode(org.hibernate.CacheMode cacheMode)
Description copied from interface:Stage.SelectionQuery
Set the currentCacheMode
in effect while this query is being executed.- Specified by:
setCacheMode
in interfaceStage.Query<R>
- Specified by:
setCacheMode
in interfaceStage.SelectionQuery<R>
-
setCacheStoreMode
public Stage.Query<R> setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode)
Description copied from interface:Stage.SelectionQuery
Set the currentCacheStoreMode
in effect while this query is being executed.- Specified by:
setCacheStoreMode
in interfaceStage.Query<R>
- Specified by:
setCacheStoreMode
in interfaceStage.SelectionQuery<R>
-
setCacheRetrieveMode
public Stage.Query<R> setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode)
Description copied from interface:Stage.SelectionQuery
Set the currentCacheRetrieveMode
in effect while this query is being executed.- Specified by:
setCacheRetrieveMode
in interfaceStage.Query<R>
- Specified by:
setCacheRetrieveMode
in interfaceStage.SelectionQuery<R>
-
isCacheable
public boolean isCacheable()
- Specified by:
isCacheable
in interfaceStage.SelectionQuery<R>
- Returns:
true
if this query is cacheable- See Also:
Stage.SelectionQuery.setCacheable(boolean)
-
setCacheable
public Stage.Query<R> setCacheable(boolean cacheable)
Description copied from interface:Stage.SelectionQuery
Enable or disable caching of this query result set in the second-level query cache.- Specified by:
setCacheable
in interfaceStage.Query<R>
- Specified by:
setCacheable
in interfaceStage.SelectionQuery<R>
- Parameters:
cacheable
-true
if this query is cacheable
-
getCacheRegion
public java.lang.String getCacheRegion()
- Specified by:
getCacheRegion
in interfaceStage.SelectionQuery<R>
- Returns:
- the name of the cache region
- See Also:
Stage.SelectionQuery.setCacheRegion(String)
-
setCacheRegion
public Stage.Query<R> setCacheRegion(java.lang.String cacheRegion)
Description copied from interface:Stage.SelectionQuery
Set the name of the cache region in which to store this query result set ifcaching is enabled
.- Specified by:
setCacheRegion
in interfaceStage.Query<R>
- Specified by:
setCacheRegion
in interfaceStage.SelectionQuery<R>
- Parameters:
cacheRegion
- the name of the cache region
-
setLockMode
public Stage.Query<R> setLockMode(jakarta.persistence.LockModeType lockMode)
Description copied from interface:Stage.SelectionQuery
Set theLockModeType
to use for the whole query.- Specified by:
setLockMode
in interfaceStage.Query<R>
- Specified by:
setLockMode
in interfaceStage.SelectionQuery<R>
-
setLockMode
public Stage.Query<R> setLockMode(java.lang.String alias, org.hibernate.LockMode lockMode)
Description copied from interface:Stage.SelectionQuery
Set theLockMode
to use for specified alias (as defined in the query'sfrom
clause).- Specified by:
setLockMode
in interfaceStage.Query<R>
- Specified by:
setLockMode
in interfaceStage.SelectionQuery<R>
- Parameters:
alias
- the from clause aliaslockMode
- the requestedLockMode
- See Also:
Query.setLockMode(String,LockMode)
-
setParameter
public Stage.Query<R> setParameter(java.lang.String name, java.lang.Object value)
Description copied from interface:Stage.AbstractQuery
Set the value of a named parameter. Named parameters are specified in the query using placeholder tokens of form:name
.- Specified by:
setParameter
in interfaceStage.AbstractQuery
- Specified by:
setParameter
in interfaceStage.MutationQuery
- Specified by:
setParameter
in interfaceStage.Query<R>
- Specified by:
setParameter
in interfaceStage.SelectionQuery<R>
- Parameters:
name
- the name of the parametervalue
- the argument to set
-
setParameter
public Stage.Query<R> setParameter(int position, java.lang.Object value)
Description copied from interface:Stage.AbstractQuery
Set the value of an ordinal parameter. Ordinal parameters are numbered from 1, and are specified in the query using placeholder tokens of form?1
,?2
, etc.- Specified by:
setParameter
in interfaceStage.AbstractQuery
- Specified by:
setParameter
in interfaceStage.MutationQuery
- Specified by:
setParameter
in interfaceStage.Query<R>
- Specified by:
setParameter
in interfaceStage.SelectionQuery<R>
- Parameters:
position
- an integer identifying the ordinal parametervalue
- the argument to set
-
setParameter
public <T1> Stage.Query<R> setParameter(jakarta.persistence.Parameter<T1> param, T1 value)
Description copied from interface:Stage.AbstractQuery
Set the value of a typed parameter. Typed parameters are obtained from the JPACriteriaBuilder
, which may itself be obtained by callingStage.SessionFactory.getCriteriaBuilder()
.- Specified by:
setParameter
in interfaceStage.AbstractQuery
- Specified by:
setParameter
in interfaceStage.MutationQuery
- Specified by:
setParameter
in interfaceStage.Query<R>
- Specified by:
setParameter
in interfaceStage.SelectionQuery<R>
- Parameters:
param
- the parametervalue
- the argument to set- See Also:
CriteriaBuilder.parameter(Class)
-
getComment
public java.lang.String getComment()
- Specified by:
getComment
in interfaceStage.AbstractQuery
-
setComment
public Stage.Query<R> setComment(java.lang.String comment)
Description copied from interface:Stage.AbstractQuery
Set the comment for this query. This comment will be prepended to the SQL query sent to the database.- Specified by:
setComment
in interfaceStage.AbstractQuery
- Specified by:
setComment
in interfaceStage.MutationQuery
- Specified by:
setComment
in interfaceStage.Query<R>
- Specified by:
setComment
in interfaceStage.SelectionQuery<R>
- Parameters:
comment
- The human-readable comment
-
executeUpdate
public java.util.concurrent.CompletionStage<java.lang.Integer> executeUpdate()
Description copied from interface:Stage.MutationQuery
Asynchronously execute this delete, update, or insert query, returning the updated row count.- Specified by:
executeUpdate
in interfaceStage.MutationQuery
- Returns:
- the row count as an integer
- See Also:
Query.executeUpdate()
-
-