Package org.hibernate.reactive.stage
Interface Stage.SelectionQuery<R>
-
- All Superinterfaces:
Stage.AbstractQuery
- All Known Subinterfaces:
Stage.Query<R>
- Enclosing interface:
- Stage
public static interface Stage.SelectionQuery<R> extends Stage.AbstractQuery
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Stage.SelectionQuery<R>
enableFetchProfile(String profileName)
Enable a fetch profile which will be in effect during execution of this query.CacheMode
getCacheMode()
Obtain theCacheMode
in effect for this query.String
getCacheRegion()
jakarta.persistence.CacheRetrieveMode
getCacheRetrieveMode()
jakarta.persistence.CacheStoreMode
getCacheStoreMode()
int
getFirstResult()
FlushMode
getFlushMode()
Obtain theFlushMode
in effect for this query.int
getMaxResults()
CompletionStage<List<R>>
getResultList()
Asynchronously execute this query, returning the query results as aList
, via aCompletionStage
.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.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.SelectionQuery<R>
setCacheable(boolean cacheable)
Enable or disable caching of this query result set in the second-level query cache.Stage.SelectionQuery<R>
setCacheMode(CacheMode cacheMode)
Set the currentCacheMode
in effect while this query is being executed.Stage.SelectionQuery<R>
setCacheRegion(String cacheRegion)
Set the name of the cache region in which to store this query result set ifcaching is enabled
.default Stage.SelectionQuery<R>
setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode)
Set the currentCacheRetrieveMode
in effect while this query is being executed.default Stage.SelectionQuery<R>
setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode)
Set the currentCacheStoreMode
in effect while this query is being executed.Stage.SelectionQuery<R>
setComment(String comment)
Set the comment for this query.Stage.SelectionQuery<R>
setFirstResult(int firstResult)
Set the position of the first result that may be returned by this query when executed, where the results are numbered from 0.default Stage.SelectionQuery<R>
setFlushMode(jakarta.persistence.FlushModeType flushModeType)
Set the currentFlushModeType
in effect while this query is being executed.Stage.SelectionQuery<R>
setFlushMode(FlushMode flushMode)
Set the currentFlushMode
in effect while this query is being executed.default Stage.SelectionQuery<R>
setLockMode(jakarta.persistence.LockModeType lockModeType)
Set theLockModeType
to use for the whole query.default Stage.SelectionQuery<R>
setLockMode(String alias, jakarta.persistence.LockModeType lockModeType)
Set theLockModeType
to use for specified alias (as defined in the query'sfrom
clause).Stage.SelectionQuery<R>
setLockMode(String alias, LockMode lockMode)
Set theLockMode
to use for specified alias (as defined in the query'sfrom
clause).Stage.SelectionQuery<R>
setLockMode(LockMode lockMode)
Set theLockMode
to use for the whole query.Stage.SelectionQuery<R>
setMaxResults(int maxResults)
Set the maximum number of results that may be returned by this query when executed.Stage.SelectionQuery<R>
setOrder(List<Order<? super R>> orderList)
If the result type of this query is an entity class, add one or more rules for ordering the query results.Stage.SelectionQuery<R>
setOrder(Order<? super R> order)
If the result type of this query is an entity class, add a rule for ordering the query results.Stage.SelectionQuery<R>
setPage(Page page)
Set the page of results to return.Stage.SelectionQuery<R>
setParameter(int parameter, Object argument)
Set the value of an ordinal parameter.<T> Stage.SelectionQuery<R>
setParameter(jakarta.persistence.Parameter<T> parameter, T argument)
Set the value of a typed parameter.Stage.SelectionQuery<R>
setParameter(String parameter, Object argument)
Set the value of a named parameter.Stage.SelectionQuery<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.SelectionQuery<R>
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies loaded by this Query.-
Methods inherited from interface org.hibernate.reactive.stage.Stage.AbstractQuery
getComment
-
-
-
-
Method Detail
-
setMaxResults
Stage.SelectionQuery<R> setMaxResults(int maxResults)
Set the maximum number of results that may be returned by this query when executed.
-
setFirstResult
Stage.SelectionQuery<R> setFirstResult(int firstResult)
Set the position of the first result that may be returned by this query when executed, where the results are numbered from 0.
-
setPage
@Incubating Stage.SelectionQuery<R> setPage(Page page)
Set the page of results to return.- Since:
- 2.1
- See Also:
Page
-
getMaxResults
int getMaxResults()
- Returns:
- the maximum number results, or
Integer.MAX_VALUE
if not set
-
getFirstResult
int getFirstResult()
- Returns:
- the first result, or 0 if not set
-
getSingleResult
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. If the query has multiple results per row, the results are returned in an instance ofObject[]
.- Returns:
- the single resulting row
- Throws:
jakarta.persistence.NoResultException
- if there is no resultjakarta.persistence.NonUniqueResultException
- if there are multiple results- See Also:
Query.getSingleResult()
-
getSingleResultOrNull
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. If the query has multiple results per row, the results are returned in an instance ofObject[]
.- Returns:
- the single resulting row or
null
- Throws:
jakarta.persistence.NonUniqueResultException
- if there are multiple results- See Also:
getSingleResult()
-
getResultList
CompletionStage<List<R>> getResultList()
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[]
.- Returns:
- the resulting rows as a
List
- See Also:
Query.getResultList()
-
setReadOnly
Stage.SelectionQuery<R> setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies loaded by this Query. This setting overrides the default setting for the persistence context.
-
isReadOnly
boolean isReadOnly()
- Returns:
- the read-only/modifiable mode
- See Also:
Stage.Session.isDefaultReadOnly()
-
setCacheable
Stage.SelectionQuery<R> setCacheable(boolean cacheable)
Enable or disable caching of this query result set in the second-level query cache.- Parameters:
cacheable
-true
if this query is cacheable
-
isCacheable
boolean isCacheable()
- Returns:
true
if this query is cacheable- See Also:
setCacheable(boolean)
-
setCacheRegion
Stage.SelectionQuery<R> setCacheRegion(String cacheRegion)
Set the name of the cache region in which to store this query result set ifcaching is enabled
.- Parameters:
cacheRegion
- the name of the cache region
-
getCacheRegion
String getCacheRegion()
- Returns:
- the name of the cache region
- See Also:
setCacheRegion(String)
-
setCacheMode
Stage.SelectionQuery<R> setCacheMode(CacheMode cacheMode)
Set the currentCacheMode
in effect while this query is being executed.
-
setCacheStoreMode
default Stage.SelectionQuery<R> setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode)
Set the currentCacheStoreMode
in effect while this query is being executed.
-
setCacheRetrieveMode
default Stage.SelectionQuery<R> setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode)
Set the currentCacheRetrieveMode
in effect while this query is being executed.
-
getCacheStoreMode
jakarta.persistence.CacheStoreMode getCacheStoreMode()
-
getCacheRetrieveMode
jakarta.persistence.CacheRetrieveMode getCacheRetrieveMode()
-
getCacheMode
CacheMode getCacheMode()
Obtain theCacheMode
in effect for this query. By default, the query inherits theCacheMode
of theStage.Session
from which is originates.- See Also:
Stage.Session.getCacheMode()
-
setFlushMode
Stage.SelectionQuery<R> setFlushMode(FlushMode flushMode)
Set the currentFlushMode
in effect while this query is being executed.
-
setFlushMode
default Stage.SelectionQuery<R> setFlushMode(jakarta.persistence.FlushModeType flushModeType)
Set the currentFlushModeType
in effect while this query is being executed.
-
getFlushMode
FlushMode getFlushMode()
Obtain theFlushMode
in effect for this query. By default, the query inherits theFlushMode
of theStage.Session
from which is originates.- See Also:
Stage.Session.getFlushMode()
-
setLockMode
Stage.SelectionQuery<R> setLockMode(LockMode lockMode)
Set theLockMode
to use for the whole query.
-
setLockMode
default Stage.SelectionQuery<R> setLockMode(jakarta.persistence.LockModeType lockModeType)
Set theLockModeType
to use for the whole query.
-
setLockMode
Stage.SelectionQuery<R> setLockMode(String alias, LockMode lockMode)
Set theLockMode
to use for specified alias (as defined in the query'sfrom
clause).- Parameters:
alias
- the from clause aliaslockMode
- the requestedLockMode
- See Also:
Query.setLockMode(String,LockMode)
-
setLockMode
default Stage.SelectionQuery<R> setLockMode(String alias, jakarta.persistence.LockModeType lockModeType)
Set theLockModeType
to use for specified alias (as defined in the query'sfrom
clause).- Parameters:
alias
- the from clause aliaslockModeType
- the requestedLockModeType
- See Also:
Query.setLockMode(String,LockMode)
-
setOrder
Stage.SelectionQuery<R> setOrder(List<Order<? super R>> orderList)
If the result type of this query is an entity class, add one or more rules for ordering the query results.- Parameters:
orderList
- one or more instances ofOrder
- See Also:
Order
,Query.setOrder(List)
-
setOrder
Stage.SelectionQuery<R> setOrder(Order<? super R> order)
If the result type of this query is an entity class, add a rule for ordering the query results.- Parameters:
order
- an instance ofOrder
- See Also:
Order
,Query.setOrder(Order)
-
setPlan
Stage.SelectionQuery<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.
-
enableFetchProfile
Stage.SelectionQuery<R> enableFetchProfile(String profileName)
Enable a fetch profile which will be in effect during execution of this query.
-
setParameter
Stage.SelectionQuery<R> setParameter(int parameter, Object argument)
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
- Parameters:
parameter
- an integer identifying the ordinal parameterargument
- the argument to set
-
setParameter
Stage.SelectionQuery<R> setParameter(String parameter, Object argument)
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
- Parameters:
parameter
- the name of the parameterargument
- the argument to set
-
setParameter
<T> Stage.SelectionQuery<R> setParameter(jakarta.persistence.Parameter<T> parameter, T argument)
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
- Parameters:
parameter
- the parameterargument
- the argument to set- See Also:
CriteriaBuilder.parameter(Class)
-
setComment
Stage.SelectionQuery<R> setComment(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
- Parameters:
comment
- The human-readable comment
-
-