Package org.hibernate.reactive.mutiny
Interface Mutiny.SelectionQuery<R>
- All Superinterfaces:
Mutiny.AbstractQuery
- All Known Subinterfaces:
Mutiny.Query<R>
- All Known Implementing Classes:
MutinyQueryImpl,MutinySelectionQueryImpl
- Enclosing interface:
- Mutiny
-
Method Summary
Modifier and TypeMethodDescriptionenableFetchProfile(String profileName) Enable a fetch profile which will be in effect during execution of this query.org.hibernate.CacheModeObtain theCacheModein effect for this query.jakarta.persistence.CacheRetrieveModejakarta.persistence.CacheStoreModeintorg.hibernate.FlushModeObtain theFlushModein effect for this query.intio.smallrye.mutiny.Uni<Long>Determine the size of the query result list that would be returned by callinggetResultList()with no offset or limit applied to the query.Asynchronously execute this query, returning the query results as aList, via aUni.io.smallrye.mutiny.Uni<R>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.io.smallrye.mutiny.Uni<R>Asynchronously execute this query, returning a single row that matches the query, ornullif the query returns no results, throwing an exception if the query returns more than one matching row.booleanbooleansetCacheable(boolean cacheable) Enable or disable caching of this query result set in the second-level query cache.setCacheMode(org.hibernate.CacheMode cacheMode) Set the currentCacheModein effect while this query is being executed.setCacheRegion(String cacheRegion) Set the name of the cache region in which to store this query result set ifcaching is enabled.default Mutiny.SelectionQuery<R>setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode) Set the currentCacheRetrieveModein effect while this query is being executed.default Mutiny.SelectionQuery<R>setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode) Set the currentCacheStoreModein effect while this query is being executed.setComment(String comment) Set the comment for this query.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 Mutiny.SelectionQuery<R>setFlushMode(jakarta.persistence.FlushModeType flushModeType) Set the currentFlushModeTypein effect while this query is being executed.setFlushMode(org.hibernate.FlushMode flushMode) Set the currentFlushModein effect while this query is being executed.default Mutiny.SelectionQuery<R>setLockMode(jakarta.persistence.LockModeType lockModeType) Set theLockModeTypeto use for the whole query.default Mutiny.SelectionQuery<R>setLockMode(String alias, jakarta.persistence.LockModeType lockModeType) Set theLockModeTypeto use for specified alias (as defined in the query'sfromclause).setLockMode(String alias, org.hibernate.LockMode lockMode) Set theLockModeto use for specified alias (as defined in the query'sfromclause).setLockMode(org.hibernate.LockMode lockMode) Set theLockModeto use for the whole query.setMaxResults(int maxResults) Set the maximum number of results that may be returned by this query when executed.setPage(org.hibernate.query.Page page) Set the page of results to return.setParameter(int parameter, Object argument) Set the value of an ordinal parameter.<T> Mutiny.SelectionQuery<R>setParameter(jakarta.persistence.Parameter<T> parameter, T argument) Set the value of a typed parameter.setParameter(String parameter, Object argument) Set the value of a named parameter.Set theEntityGraphthat will be used as a fetch plan for the root entity returned by this query.setReadOnly(boolean readOnly) Set the read-only/modifiable mode for entities and proxies loaded by this Query.Methods inherited from interface org.hibernate.reactive.mutiny.Mutiny.AbstractQuery
getComment
-
Method Details
-
setMaxResults
Set the maximum number of results that may be returned by this query when executed. -
setFirstResult
Set the position of the first result that may be returned by this query when executed, where the results are numbered from 0. -
setPage
Set the page of results to return.- Since:
- 2.1
- See Also:
-
Page
-
getMaxResults
int getMaxResults()- Returns:
- the maximum number results, or
Integer.MAX_VALUEif not set
-
getFirstResult
int getFirstResult()- Returns:
- the first result, or 0 if not set
-
getSingleResult
io.smallrye.mutiny.Uni<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
io.smallrye.mutiny.Uni<R> getSingleResultOrNull()Asynchronously execute this query, returning a single row that matches the query, ornullif 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:
-
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
-
getResultList
Asynchronously execute this query, returning the query results as aList, via aUni. 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
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:
-
setCacheable
Enable or disable caching of this query result set in the second-level query cache.- Parameters:
cacheable-trueif this query is cacheable
-
isCacheable
boolean isCacheable()- Returns:
trueif this query is cacheable- See Also:
-
setCacheRegion
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:
-
setCacheMode
Set the currentCacheModein effect while this query is being executed. -
setCacheStoreMode
default Mutiny.SelectionQuery<R> setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode) Set the currentCacheStoreModein effect while this query is being executed. -
setCacheRetrieveMode
default Mutiny.SelectionQuery<R> setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode) Set the currentCacheRetrieveModein effect while this query is being executed. -
getCacheStoreMode
jakarta.persistence.CacheStoreMode getCacheStoreMode() -
getCacheRetrieveMode
jakarta.persistence.CacheRetrieveMode getCacheRetrieveMode() -
getCacheMode
org.hibernate.CacheMode getCacheMode()Obtain theCacheModein effect for this query. By default, the query inherits theCacheModeof theMutiny.Sessionfrom which is originates.- See Also:
-
setFlushMode
Set the currentFlushModein effect while this query is being executed. -
setFlushMode
Set the currentFlushModeTypein effect while this query is being executed. -
getFlushMode
org.hibernate.FlushMode getFlushMode()Obtain theFlushModein effect for this query. By default, the query inherits theFlushModeof theMutiny.Sessionfrom which is originates.- See Also:
-
setLockMode
Set theLockModeto use for the whole query. -
setLockMode
Set theLockModeTypeto use for the whole query. -
setLockMode
Set theLockModeto use for specified alias (as defined in the query'sfromclause).- Parameters:
alias- the from clause aliaslockMode- the requestedLockMode- See Also:
-
Query.setLockMode(String,LockMode)
-
setLockMode
default Mutiny.SelectionQuery<R> setLockMode(String alias, jakarta.persistence.LockModeType lockModeType) Set theLockModeTypeto use for specified alias (as defined in the query'sfromclause).- Parameters:
alias- the from clause aliaslockModeType- the requestedLockModeType- See Also:
-
Query.setLockMode(String,LockMode)
-
setPlan
Set theEntityGraphthat will be used as a fetch plan for the root entity returned by this query. -
enableFetchProfile
Enable a fetch profile which will be in effect during execution of this query. -
setParameter
Description copied from interface:Mutiny.AbstractQuerySet 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:
setParameterin interfaceMutiny.AbstractQuery- Parameters:
parameter- an integer identifying the ordinal parameterargument- the argument to set
-
setParameter
Description copied from interface:Mutiny.AbstractQuerySet the value of a named parameter. Named parameters are specified in the query using placeholder tokens of form:name.- Specified by:
setParameterin interfaceMutiny.AbstractQuery- Parameters:
parameter- the name of the parameterargument- the argument to set
-
setParameter
Description copied from interface:Mutiny.AbstractQuerySet the value of a typed parameter. Typed parameters are obtained from the JPACriteriaBuilder, which may itself be obtained by callingMutiny.SessionFactory.getCriteriaBuilder().- Specified by:
setParameterin interfaceMutiny.AbstractQuery- Parameters:
parameter- the parameterargument- the argument to set- See Also:
-
CriteriaBuilder.parameter(Class)
-
setComment
Description copied from interface:Mutiny.AbstractQuerySet the comment for this query. This comment will be prepended to the SQL query sent to the database.- Specified by:
setCommentin interfaceMutiny.AbstractQuery- Parameters:
comment- The human-readable comment
-