Class MutinyQueryImpl<R>
- java.lang.Object
-
- org.hibernate.reactive.mutiny.impl.MutinyQueryImpl<R>
-
- All Implemented Interfaces:
Mutiny.Query<R>
public class MutinyQueryImpl<R> extends java.lang.Object implements Mutiny.Query<R>
Implementation ofMutiny.Query
.
-
-
Constructor Summary
Constructors Constructor Description MutinyQueryImpl(ReactiveQuery<R> delegate, java.lang.String[] querySpaces, MutinySessionFactoryImpl factory)
MutinyQueryImpl(ReactiveQuery<R> delegate, MutinySessionFactoryImpl factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
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>
setComment(java.lang.String comment)
Set the comment for this query.Mutiny.Query<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.Mutiny.Query<R>
setFlushMode(org.hibernate.FlushMode flushMode)
Set the currentFlushMode
in effect while this query is being executed.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>
setLockOptions(org.hibernate.LockOptions lockOptions)
Mutiny.Query<R>
setMaxResults(int maxResults)
Set the maximum number of results that may be returned by this query when executed.Mutiny.Query<R>
setParameter(int position, java.lang.Object value)
Set the value of an ordinal parameter.Mutiny.Query<R>
setParameter(java.lang.String name, java.lang.Object value)
Set the value of a named parameter.<T> Mutiny.Query<R>
setParameter(javax.persistence.Parameter<T> name, T value)
Set the value of a typed parameter.Mutiny.Query<R>
setPlan(javax.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.
-
-
-
Constructor Detail
-
MutinyQueryImpl
public MutinyQueryImpl(ReactiveQuery<R> delegate, MutinySessionFactoryImpl factory)
-
MutinyQueryImpl
public MutinyQueryImpl(ReactiveQuery<R> delegate, java.lang.String[] querySpaces, MutinySessionFactoryImpl factory)
-
-
Method Detail
-
setParameter
public Mutiny.Query<R> setParameter(int position, java.lang.Object value)
Description copied from interface:Mutiny.Query
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.Query<R>
- Parameters:
position
- an integer identifying the ordinal parametervalue
- the argument to set
-
setParameter
public Mutiny.Query<R> setParameter(java.lang.String name, java.lang.Object value)
Description copied from interface:Mutiny.Query
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.Query<R>
- Parameters:
name
- the name of the parametervalue
- the argument to set
-
setParameter
public <T> Mutiny.Query<R> setParameter(javax.persistence.Parameter<T> name, T value)
Description copied from interface:Mutiny.Query
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.Query<R>
- Parameters:
name
- the parametervalue
- the argument to set- See Also:
CriteriaBuilder.parameter(Class)
-
setMaxResults
public Mutiny.Query<R> setMaxResults(int maxResults)
Description copied from interface:Mutiny.Query
Set the maximum number of results that may be returned by this query when executed.- Specified by:
setMaxResults
in interfaceMutiny.Query<R>
-
getMaxResults
public int getMaxResults()
- Specified by:
getMaxResults
in interfaceMutiny.Query<R>
- Returns:
- the maximum number results, or
Integer.MAX_VALUE
if not set
-
setFirstResult
public Mutiny.Query<R> setFirstResult(int firstResult)
Description copied from interface:Mutiny.Query
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>
-
getFirstResult
public int getFirstResult()
- Specified by:
getFirstResult
in interfaceMutiny.Query<R>
- Returns:
- the first result, or 0 if not set
-
setReadOnly
public Mutiny.Query<R> setReadOnly(boolean readOnly)
Description copied from interface:Mutiny.Query
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>
- See Also:
Mutiny.Session.setDefaultReadOnly(boolean)
-
isReadOnly
public boolean isReadOnly()
- Specified by:
isReadOnly
in interfaceMutiny.Query<R>
- Returns:
- the read-only/modifiable mode
- See Also:
Mutiny.Session.isDefaultReadOnly()
-
setComment
public Mutiny.Query<R> setComment(java.lang.String comment)
Description copied from interface:Mutiny.Query
Set the comment for this query. This comment will be prepended to the SQL query sent to the database.- Specified by:
setComment
in interfaceMutiny.Query<R>
- Parameters:
comment
- The human-readable comment
-
setCacheable
public Mutiny.Query<R> setCacheable(boolean cacheable)
Description copied from interface:Mutiny.Query
Enable or disable caching of this query result set in the second-level query cache.- Specified by:
setCacheable
in interfaceMutiny.Query<R>
- Parameters:
cacheable
-true
if this query is cacheable
-
isCacheable
public boolean isCacheable()
- Specified by:
isCacheable
in interfaceMutiny.Query<R>
- Returns:
true
if this query is cacheable- See Also:
Mutiny.Query.setCacheable(boolean)
-
setCacheRegion
public Mutiny.Query<R> setCacheRegion(java.lang.String cacheRegion)
Description copied from interface:Mutiny.Query
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>
- Parameters:
cacheRegion
- the name of the cache region
-
getCacheRegion
public java.lang.String getCacheRegion()
- Specified by:
getCacheRegion
in interfaceMutiny.Query<R>
- Returns:
- the name of the cache region
- See Also:
Mutiny.Query.setCacheRegion(String)
-
setLockMode
public Mutiny.Query<R> setLockMode(org.hibernate.LockMode lockMode)
Description copied from interface:Mutiny.Query
Set theLockMode
to use for the whole query.- Specified by:
setLockMode
in interfaceMutiny.Query<R>
-
setLockOptions
public Mutiny.Query<R> setLockOptions(org.hibernate.LockOptions lockOptions)
-
setLockMode
public Mutiny.Query<R> setLockMode(java.lang.String alias, org.hibernate.LockMode lockMode)
Description copied from interface:Mutiny.Query
Set theLockMode
to use for specified alias (as defined in the query'sfrom
clause).- Specified by:
setLockMode
in interfaceMutiny.Query<R>
- Parameters:
alias
- the from clause aliaslockMode
- the requestedLockMode
- See Also:
Query.setLockMode(String,LockMode)
-
setCacheMode
public Mutiny.Query<R> setCacheMode(org.hibernate.CacheMode cacheMode)
Description copied from interface:Mutiny.Query
Set the currentCacheMode
in effect while this query is being executed.- Specified by:
setCacheMode
in interfaceMutiny.Query<R>
-
getCacheMode
public org.hibernate.CacheMode getCacheMode()
Description copied from interface:Mutiny.Query
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.Query<R>
- See Also:
Mutiny.Session.getCacheMode()
-
setFlushMode
public Mutiny.Query<R> setFlushMode(org.hibernate.FlushMode flushMode)
Description copied from interface:Mutiny.Query
Set the currentFlushMode
in effect while this query is being executed.- Specified by:
setFlushMode
in interfaceMutiny.Query<R>
-
getFlushMode
public org.hibernate.FlushMode getFlushMode()
Description copied from interface:Mutiny.Query
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.Query<R>
- See Also:
Mutiny.Session.getFlushMode()
-
setPlan
public Mutiny.Query<R> setPlan(javax.persistence.EntityGraph<R> entityGraph)
Description copied from interface:Mutiny.Query
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>
-
executeUpdate
public io.smallrye.mutiny.Uni<java.lang.Integer> executeUpdate()
Description copied from interface:Mutiny.Query
Asynchronously execute this delete, update, or insert query, returning the updated row count.- Specified by:
executeUpdate
in interfaceMutiny.Query<R>
- Returns:
- the row count as an integer
- See Also:
Query.executeUpdate()
-
getSingleResult
public io.smallrye.mutiny.Uni<R> getSingleResult()
Description copied from interface:Mutiny.Query
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.Query<R>
- Returns:
- the single resulting row
- See Also:
Query.getSingleResult()
-
getSingleResultOrNull
public io.smallrye.mutiny.Uni<R> getSingleResultOrNull()
Description copied from interface:Mutiny.Query
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.Query<R>
- Returns:
- the single resulting row or
null
- See Also:
Mutiny.Query.getSingleResult()
-
getResultList
public io.smallrye.mutiny.Uni<java.util.List<R>> getResultList()
Description copied from interface:Mutiny.Query
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[]
. If the query has multiple results per row, the results are returned in an instance ofObject[]
.- Specified by:
getResultList
in interfaceMutiny.Query<R>
- Returns:
- the resulting rows as a
List
- See Also:
Query.getResultList()
-
-