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>
public class MutinyQueryImpl<R> extends java.lang.Object implements Mutiny.Query<R>
-
-
Constructor Summary
Constructors Constructor Description MutinyQueryImpl(ReactiveQuery<R> delegate, MutinySessionFactoryImpl factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mutiny.Query<R>
enableFetchProfile(java.lang.String profileName)
Enable a fetch profile which will be in effect during execution of this query.io.smallrye.mutiny.Uni<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()
io.smallrye.mutiny.Uni<java.util.List<R>>
getResultList()
Asynchronously execute this query, returning the query results as aList
, via aUni
.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.io.smallrye.mutiny.Uni<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()
Mutiny.Query<R>
setCacheable(boolean cacheable)
Enable or disable caching of this query result set in the second-level query cache.Mutiny.Query<R>
setCacheMode(org.hibernate.CacheMode cacheMode)
Set the currentCacheMode
in effect while this query is being executed.Mutiny.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
.Mutiny.Query<R>
setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode)
Set the currentCacheRetrieveMode
in effect while this query is being executed.Mutiny.Query<R>
setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode)
Set the currentCacheStoreMode
in effect while this query is being executed.Mutiny.Query<R>
setComment(java.lang.String comment)
Set the comment for this query.Mutiny.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.Mutiny.Query<R>
setFlushMode(jakarta.persistence.FlushModeType flushMode)
Set the currentFlushModeType
in effect while this query is being executed.Mutiny.Query<R>
setFlushMode(org.hibernate.FlushMode flushMode)
Set the currentFlushMode
in effect while this query is being executed.Mutiny.Query<R>
setLockMode(jakarta.persistence.LockModeType lockMode)
Set theLockModeType
to use for the whole query.Mutiny.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).Mutiny.Query<R>
setLockMode(org.hibernate.LockMode lockMode)
Set theLockMode
to use for the whole query.Mutiny.Query<R>
setMaxResults(int maxResult)
Set the maximum number of results that may be returned by this query when executed.Mutiny.SelectionQuery<R>
setPage(org.hibernate.query.Page page)
Set the page of results to return.Mutiny.Query<R>
setParameter(int position, java.lang.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.Mutiny.Query<R>
setParameter(java.lang.String name, java.lang.Object value)
Set the value of a named parameter.Mutiny.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.Mutiny.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.mutiny.Mutiny.Query
setLockMode
-
-
-
-
Constructor Detail
-
MutinyQueryImpl
public MutinyQueryImpl(ReactiveQuery<R> delegate, MutinySessionFactoryImpl factory)
-
-
Method Detail
-
getMaxResults
public int getMaxResults()
- Specified by:
getMaxResults
in interfaceMutiny.SelectionQuery<R>
- Returns:
- the maximum number results, or
Integer.MAX_VALUE
if not set
-
getResultList
public io.smallrye.mutiny.Uni<java.util.List<R>> getResultList()
Description copied from interface:Mutiny.SelectionQuery
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[]
.- Specified by:
getResultList
in 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.SelectionQuery
Obtain theFlushMode
in effect for this query. By default, the query inherits theFlushMode
of theMutiny.Session
from which is originates.- Specified by:
getFlushMode
in interfaceMutiny.SelectionQuery<R>
- See Also:
Mutiny.Session.getFlushMode()
-
setFlushMode
public Mutiny.Query<R> setFlushMode(org.hibernate.FlushMode flushMode)
Description copied from interface:Mutiny.SelectionQuery
Set the currentFlushMode
in effect while this query is being executed.- Specified by:
setFlushMode
in interfaceMutiny.Query<R>
- Specified by:
setFlushMode
in interfaceMutiny.SelectionQuery<R>
-
setLockMode
public Mutiny.Query<R> setLockMode(org.hibernate.LockMode lockMode)
Description copied from interface:Mutiny.SelectionQuery
Set theLockMode
to use for the whole query.- Specified by:
setLockMode
in interfaceMutiny.Query<R>
- Specified by:
setLockMode
in interfaceMutiny.SelectionQuery<R>
-
setPlan
public Mutiny.Query<R> setPlan(jakarta.persistence.EntityGraph<R> entityGraph)
Description copied from interface:Mutiny.SelectionQuery
Set theEntityGraph
that will be used as a fetch plan for the root entity returned by this query.- Specified by:
setPlan
in interfaceMutiny.Query<R>
- Specified by:
setPlan
in interfaceMutiny.SelectionQuery<R>
-
enableFetchProfile
public Mutiny.Query<R> enableFetchProfile(java.lang.String profileName)
Description copied from interface:Mutiny.SelectionQuery
Enable a fetch profile which will be in effect during execution of this query.- Specified by:
enableFetchProfile
in interfaceMutiny.Query<R>
- Specified by:
enableFetchProfile
in interfaceMutiny.SelectionQuery<R>
-
getSingleResult
public io.smallrye.mutiny.Uni<R> getSingleResult()
Description copied from interface:Mutiny.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 interfaceMutiny.SelectionQuery<R>
- Returns:
- the single resulting row
- See Also:
Query.getSingleResult()
-
getSingleResultOrNull
public io.smallrye.mutiny.Uni<R> getSingleResultOrNull()
Description copied from interface:Mutiny.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 interfaceMutiny.SelectionQuery<R>
- Returns:
- the single resulting row or
null
- See Also:
Mutiny.SelectionQuery.getSingleResult()
-
setFlushMode
public Mutiny.Query<R> setFlushMode(jakarta.persistence.FlushModeType flushMode)
Description copied from interface:Mutiny.SelectionQuery
Set the currentFlushModeType
in effect while this query is being executed.- Specified by:
setFlushMode
in interfaceMutiny.Query<R>
- Specified by:
setFlushMode
in interfaceMutiny.SelectionQuery<R>
-
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnly
in interfaceMutiny.SelectionQuery<R>
- Returns:
- the read-only/modifiable mode
- See Also:
Mutiny.Session.isDefaultReadOnly()
-
setReadOnly
public Mutiny.Query<R> setReadOnly(boolean readOnly)
Description copied from interface:Mutiny.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 interfaceMutiny.Query<R>
- Specified by:
setReadOnly
in interfaceMutiny.SelectionQuery<R>
- See Also:
Mutiny.Session.setDefaultReadOnly(boolean)
-
setMaxResults
public Mutiny.Query<R> setMaxResults(int maxResult)
Description copied from interface:Mutiny.SelectionQuery
Set the maximum number of results that may be returned by this query when executed.- Specified by:
setMaxResults
in interfaceMutiny.Query<R>
- Specified by:
setMaxResults
in interfaceMutiny.SelectionQuery<R>
-
getFirstResult
public int getFirstResult()
- Specified by:
getFirstResult
in interfaceMutiny.SelectionQuery<R>
- Returns:
- the first result, or 0 if not set
-
setFirstResult
public Mutiny.Query<R> setFirstResult(int startPosition)
Description copied from interface:Mutiny.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 interfaceMutiny.Query<R>
- Specified by:
setFirstResult
in interfaceMutiny.SelectionQuery<R>
-
setPage
public Mutiny.SelectionQuery<R> setPage(org.hibernate.query.Page page)
Description copied from interface:Mutiny.SelectionQuery
Set the page of results to return.- Specified by:
setPage
in interfaceMutiny.SelectionQuery<R>
- See Also:
Page
-
getCacheMode
public org.hibernate.CacheMode getCacheMode()
Description copied from interface:Mutiny.SelectionQuery
Obtain theCacheMode
in effect for this query. By default, the query inherits theCacheMode
of theMutiny.Session
from which is originates.- Specified by:
getCacheMode
in interfaceMutiny.SelectionQuery<R>
- See Also:
Mutiny.Session.getCacheMode()
-
getCacheStoreMode
public jakarta.persistence.CacheStoreMode getCacheStoreMode()
- Specified by:
getCacheStoreMode
in interfaceMutiny.SelectionQuery<R>
-
getCacheRetrieveMode
public jakarta.persistence.CacheRetrieveMode getCacheRetrieveMode()
- Specified by:
getCacheRetrieveMode
in interfaceMutiny.SelectionQuery<R>
-
setCacheMode
public Mutiny.Query<R> setCacheMode(org.hibernate.CacheMode cacheMode)
Description copied from interface:Mutiny.SelectionQuery
Set the currentCacheMode
in effect while this query is being executed.- Specified by:
setCacheMode
in interfaceMutiny.Query<R>
- Specified by:
setCacheMode
in interfaceMutiny.SelectionQuery<R>
-
setCacheStoreMode
public Mutiny.Query<R> setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode)
Description copied from interface:Mutiny.SelectionQuery
Set the currentCacheStoreMode
in effect while this query is being executed.- Specified by:
setCacheStoreMode
in interfaceMutiny.Query<R>
- Specified by:
setCacheStoreMode
in interfaceMutiny.SelectionQuery<R>
-
setCacheRetrieveMode
public Mutiny.Query<R> setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode)
Description copied from interface:Mutiny.SelectionQuery
Set the currentCacheRetrieveMode
in effect while this query is being executed.- Specified by:
setCacheRetrieveMode
in interfaceMutiny.Query<R>
- Specified by:
setCacheRetrieveMode
in interfaceMutiny.SelectionQuery<R>
-
isCacheable
public boolean isCacheable()
- Specified by:
isCacheable
in interfaceMutiny.SelectionQuery<R>
- Returns:
true
if this query is cacheable- See Also:
Mutiny.SelectionQuery.setCacheable(boolean)
-
setCacheable
public Mutiny.Query<R> setCacheable(boolean cacheable)
Description copied from interface:Mutiny.SelectionQuery
Enable or disable caching of this query result set in the second-level query cache.- Specified by:
setCacheable
in interfaceMutiny.Query<R>
- Specified by:
setCacheable
in interfaceMutiny.SelectionQuery<R>
- Parameters:
cacheable
-true
if this query is cacheable
-
getCacheRegion
public java.lang.String getCacheRegion()
- Specified by:
getCacheRegion
in interfaceMutiny.SelectionQuery<R>
- Returns:
- the name of the cache region
- See Also:
Mutiny.SelectionQuery.setCacheRegion(String)
-
setCacheRegion
public Mutiny.Query<R> setCacheRegion(java.lang.String cacheRegion)
Description copied from interface:Mutiny.SelectionQuery
Set the name of the cache region in which to store this query result set ifcaching is enabled
.- Specified by:
setCacheRegion
in interfaceMutiny.Query<R>
- Specified by:
setCacheRegion
in interfaceMutiny.SelectionQuery<R>
- Parameters:
cacheRegion
- the name of the cache region
-
setLockMode
public Mutiny.Query<R> setLockMode(jakarta.persistence.LockModeType lockMode)
Description copied from interface:Mutiny.SelectionQuery
Set theLockModeType
to use for the whole query.- Specified by:
setLockMode
in interfaceMutiny.Query<R>
- Specified by:
setLockMode
in interfaceMutiny.SelectionQuery<R>
-
setLockMode
public Mutiny.Query<R> setLockMode(java.lang.String alias, org.hibernate.LockMode lockMode)
Description copied from interface:Mutiny.SelectionQuery
Set theLockMode
to use for specified alias (as defined in the query'sfrom
clause).- Specified by:
setLockMode
in interfaceMutiny.Query<R>
- Specified by:
setLockMode
in interfaceMutiny.SelectionQuery<R>
- Parameters:
alias
- the from clause aliaslockMode
- the requestedLockMode
- See Also:
Query.setLockMode(String,LockMode)
-
setParameter
public Mutiny.Query<R> setParameter(java.lang.String name, java.lang.Object value)
Description copied from interface:Mutiny.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 interfaceMutiny.AbstractQuery
- Specified by:
setParameter
in interfaceMutiny.MutationQuery
- Specified by:
setParameter
in interfaceMutiny.Query<R>
- Specified by:
setParameter
in interfaceMutiny.SelectionQuery<R>
- Parameters:
name
- the name of the parametervalue
- the argument to set
-
setParameter
public Mutiny.Query<R> setParameter(int position, java.lang.Object value)
Description copied from interface:Mutiny.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 interfaceMutiny.AbstractQuery
- Specified by:
setParameter
in interfaceMutiny.MutationQuery
- Specified by:
setParameter
in interfaceMutiny.Query<R>
- Specified by:
setParameter
in interfaceMutiny.SelectionQuery<R>
- Parameters:
position
- an integer identifying the ordinal parametervalue
- the argument to set
-
setParameter
public <T1> Mutiny.Query<R> setParameter(jakarta.persistence.Parameter<T1> param, T1 value)
Description copied from interface:Mutiny.AbstractQuery
Set the value of a typed parameter. Typed parameters are obtained from the JPACriteriaBuilder
, which may itself be obtained by callingMutiny.SessionFactory.getCriteriaBuilder()
.- Specified by:
setParameter
in interfaceMutiny.AbstractQuery
- Specified by:
setParameter
in interfaceMutiny.MutationQuery
- Specified by:
setParameter
in interfaceMutiny.Query<R>
- Specified by:
setParameter
in interfaceMutiny.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 interfaceMutiny.AbstractQuery
-
setComment
public Mutiny.Query<R> setComment(java.lang.String comment)
Description copied from interface:Mutiny.AbstractQuery
Set the comment for this query. This comment will be prepended to the SQL query sent to the database.- Specified by:
setComment
in interfaceMutiny.AbstractQuery
- Specified by:
setComment
in interfaceMutiny.MutationQuery
- Specified by:
setComment
in interfaceMutiny.Query<R>
- Specified by:
setComment
in interfaceMutiny.SelectionQuery<R>
- Parameters:
comment
- The human-readable comment
-
executeUpdate
public io.smallrye.mutiny.Uni<java.lang.Integer> executeUpdate()
Description copied from interface:Mutiny.MutationQuery
Asynchronously execute this delete, update, or insert query, returning the updated row count.- Specified by:
executeUpdate
in interfaceMutiny.MutationQuery
- Returns:
- the row count as an integer
- See Also:
Query.executeUpdate()
-
-