Class MutinyQueryImpl<R>
java.lang.Object
org.hibernate.reactive.mutiny.impl.MutinyQueryImpl<R>
- All Implemented Interfaces:
Mutiny.AbstractQuery,Mutiny.MutationQuery,Mutiny.Query<R>,Mutiny.SelectionQuery<R>
-
Constructor Summary
ConstructorsConstructorDescriptionMutinyQueryImpl(ReactiveQuery<R> delegate, MutinySessionFactoryImpl factory) -
Method Summary
Modifier and TypeMethodDescriptionenableFetchProfile(String profileName) Enable a fetch profile which will be in effect during execution of this query.io.smallrye.mutiny.Uni<Integer>Asynchronously execute this delete, update, or insert query, returning the updated row count.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 callingMutiny.SelectionQuery.getResultList()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.setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode) Set the currentCacheRetrieveModein effect while this query is being executed.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 startPosition) Set the position of the first result that may be returned by this query when executed, where the results are numbered from 0.setFlushMode(jakarta.persistence.FlushModeType flushMode) 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.setLockMode(jakarta.persistence.LockModeType lockMode) Set theLockModeTypeto use for the whole query.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 maxResult) 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 position, Object value) Set the value of an ordinal parameter.<T1> Mutiny.Query<R>setParameter(jakarta.persistence.Parameter<T1> param, T1 value) Set the value of a typed parameter.setParameter(String name, Object value) 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.reactive.mutiny.Mutiny.Query
setLockMode
-
Constructor Details
-
MutinyQueryImpl
-
-
Method Details
-
getMaxResults
public int getMaxResults()- Specified by:
getMaxResultsin interfaceMutiny.SelectionQuery<R>- Returns:
- the maximum number results, or
Integer.MAX_VALUEif not set
-
getResultCount
Description copied from interface:Mutiny.SelectionQueryDetermine the size of the query result list that would be returned by callingMutiny.SelectionQuery.getResultList()with no offset or limit applied to the query.- Specified by:
getResultCountin interfaceMutiny.SelectionQuery<R>- Returns:
- the size of the list that would be returned
-
getResultList
Description copied from interface:Mutiny.SelectionQueryAsynchronously 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[].- Specified by:
getResultListin interfaceMutiny.SelectionQuery<R>- Returns:
- the resulting rows as a
List - See Also:
-
Query.getResultList()
-
getFlushMode
public org.hibernate.FlushMode getFlushMode()Description copied from interface:Mutiny.SelectionQueryObtain theFlushModein effect for this query. By default, the query inherits theFlushModeof theMutiny.Sessionfrom which is originates.- Specified by:
getFlushModein interfaceMutiny.SelectionQuery<R>- See Also:
-
setFlushMode
Description copied from interface:Mutiny.SelectionQuerySet the currentFlushModein effect while this query is being executed.- Specified by:
setFlushModein interfaceMutiny.Query<R>- Specified by:
setFlushModein interfaceMutiny.SelectionQuery<R>
-
setLockMode
Description copied from interface:Mutiny.SelectionQuerySet theLockModeto use for the whole query.- Specified by:
setLockModein interfaceMutiny.Query<R>- Specified by:
setLockModein interfaceMutiny.SelectionQuery<R>
-
setPlan
Description copied from interface:Mutiny.SelectionQuerySet theEntityGraphthat will be used as a fetch plan for the root entity returned by this query.- Specified by:
setPlanin interfaceMutiny.Query<R>- Specified by:
setPlanin interfaceMutiny.SelectionQuery<R>
-
enableFetchProfile
Description copied from interface:Mutiny.SelectionQueryEnable a fetch profile which will be in effect during execution of this query.- Specified by:
enableFetchProfilein interfaceMutiny.Query<R>- Specified by:
enableFetchProfilein interfaceMutiny.SelectionQuery<R>
-
getSingleResult
Description copied from interface:Mutiny.SelectionQueryAsynchronously 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:
getSingleResultin interfaceMutiny.SelectionQuery<R>- Returns:
- the single resulting row
- See Also:
-
Query.getSingleResult()
-
getSingleResultOrNull
Description copied from interface:Mutiny.SelectionQueryAsynchronously 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[].- Specified by:
getSingleResultOrNullin interfaceMutiny.SelectionQuery<R>- Returns:
- the single resulting row or
null - See Also:
-
setFlushMode
Description copied from interface:Mutiny.SelectionQuerySet the currentFlushModeTypein effect while this query is being executed.- Specified by:
setFlushModein interfaceMutiny.Query<R>- Specified by:
setFlushModein interfaceMutiny.SelectionQuery<R>
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnlyin interfaceMutiny.SelectionQuery<R>- Returns:
- the read-only/modifiable mode
- See Also:
-
setReadOnly
Description copied from interface:Mutiny.SelectionQuerySet 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:
setReadOnlyin interfaceMutiny.Query<R>- Specified by:
setReadOnlyin interfaceMutiny.SelectionQuery<R>- See Also:
-
setMaxResults
Description copied from interface:Mutiny.SelectionQuerySet the maximum number of results that may be returned by this query when executed.- Specified by:
setMaxResultsin interfaceMutiny.Query<R>- Specified by:
setMaxResultsin interfaceMutiny.SelectionQuery<R>
-
getFirstResult
public int getFirstResult()- Specified by:
getFirstResultin interfaceMutiny.SelectionQuery<R>- Returns:
- the first result, or 0 if not set
-
setFirstResult
Description copied from interface:Mutiny.SelectionQuerySet the position of the first result that may be returned by this query when executed, where the results are numbered from 0.- Specified by:
setFirstResultin interfaceMutiny.Query<R>- Specified by:
setFirstResultin interfaceMutiny.SelectionQuery<R>
-
setPage
Description copied from interface:Mutiny.SelectionQuerySet the page of results to return.- Specified by:
setPagein interfaceMutiny.SelectionQuery<R>- See Also:
-
Page
-
getCacheMode
public org.hibernate.CacheMode getCacheMode()Description copied from interface:Mutiny.SelectionQueryObtain theCacheModein effect for this query. By default, the query inherits theCacheModeof theMutiny.Sessionfrom which is originates.- Specified by:
getCacheModein interfaceMutiny.SelectionQuery<R>- See Also:
-
getCacheStoreMode
public jakarta.persistence.CacheStoreMode getCacheStoreMode()- Specified by:
getCacheStoreModein interfaceMutiny.SelectionQuery<R>
-
getCacheRetrieveMode
public jakarta.persistence.CacheRetrieveMode getCacheRetrieveMode()- Specified by:
getCacheRetrieveModein interfaceMutiny.SelectionQuery<R>
-
setCacheMode
Description copied from interface:Mutiny.SelectionQuerySet the currentCacheModein effect while this query is being executed.- Specified by:
setCacheModein interfaceMutiny.Query<R>- Specified by:
setCacheModein interfaceMutiny.SelectionQuery<R>
-
setCacheStoreMode
Description copied from interface:Mutiny.SelectionQuerySet the currentCacheStoreModein effect while this query is being executed.- Specified by:
setCacheStoreModein interfaceMutiny.Query<R>- Specified by:
setCacheStoreModein interfaceMutiny.SelectionQuery<R>
-
setCacheRetrieveMode
public Mutiny.Query<R> setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode) Description copied from interface:Mutiny.SelectionQuerySet the currentCacheRetrieveModein effect while this query is being executed.- Specified by:
setCacheRetrieveModein interfaceMutiny.Query<R>- Specified by:
setCacheRetrieveModein interfaceMutiny.SelectionQuery<R>
-
isCacheable
public boolean isCacheable()- Specified by:
isCacheablein interfaceMutiny.SelectionQuery<R>- Returns:
trueif this query is cacheable- See Also:
-
setCacheable
Description copied from interface:Mutiny.SelectionQueryEnable or disable caching of this query result set in the second-level query cache.- Specified by:
setCacheablein interfaceMutiny.Query<R>- Specified by:
setCacheablein interfaceMutiny.SelectionQuery<R>- Parameters:
cacheable-trueif this query is cacheable
-
getCacheRegion
- Specified by:
getCacheRegionin interfaceMutiny.SelectionQuery<R>- Returns:
- the name of the cache region
- See Also:
-
setCacheRegion
Description copied from interface:Mutiny.SelectionQuerySet the name of the cache region in which to store this query result set ifcaching is enabled.- Specified by:
setCacheRegionin interfaceMutiny.Query<R>- Specified by:
setCacheRegionin interfaceMutiny.SelectionQuery<R>- Parameters:
cacheRegion- the name of the cache region
-
setLockMode
Description copied from interface:Mutiny.SelectionQuerySet theLockModeTypeto use for the whole query.- Specified by:
setLockModein interfaceMutiny.Query<R>- Specified by:
setLockModein interfaceMutiny.SelectionQuery<R>
-
setLockMode
Description copied from interface:Mutiny.SelectionQuerySet theLockModeto use for specified alias (as defined in the query'sfromclause).- Specified by:
setLockModein interfaceMutiny.Query<R>- Specified by:
setLockModein interfaceMutiny.SelectionQuery<R>- Parameters:
alias- the from clause aliaslockMode- the requestedLockMode- See Also:
-
SelectionQuery.setLockMode(String,LockMode)
-
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- Specified by:
setParameterin interfaceMutiny.MutationQuery- Specified by:
setParameterin interfaceMutiny.Query<R>- Specified by:
setParameterin interfaceMutiny.SelectionQuery<R>- Parameters:
name- the name of the parametervalue- the argument to set
-
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- Specified by:
setParameterin interfaceMutiny.MutationQuery- Specified by:
setParameterin interfaceMutiny.Query<R>- Specified by:
setParameterin interfaceMutiny.SelectionQuery<R>- Parameters:
position- an integer identifying the ordinal parametervalue- 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- Specified by:
setParameterin interfaceMutiny.MutationQuery- Specified by:
setParameterin interfaceMutiny.Query<R>- Specified by:
setParameterin interfaceMutiny.SelectionQuery<R>- Parameters:
param- the parametervalue- the argument to set- See Also:
-
CriteriaBuilder.parameter(Class)
-
getComment
- Specified by:
getCommentin interfaceMutiny.AbstractQuery
-
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- Specified by:
setCommentin interfaceMutiny.MutationQuery- Specified by:
setCommentin interfaceMutiny.Query<R>- Specified by:
setCommentin interfaceMutiny.SelectionQuery<R>- Parameters:
comment- The human-readable comment
-
executeUpdate
Description copied from interface:Mutiny.MutationQueryAsynchronously execute this delete, update, or insert query, returning the updated row count.- Specified by:
executeUpdatein interfaceMutiny.MutationQuery- Returns:
- the row count as an integer
- See Also:
-
Query.executeUpdate()
-