public class MutinySessionImpl extends java.lang.Object implements Mutiny.Session
Mutiny.Session
API. This delegating class is
needed to avoid name clashes when implementing both
Session
and Session
.Constructor and Description |
---|
MutinySessionImpl(ReactiveSession session,
MutinySessionFactoryImpl factory) |
Modifier and Type | Method and Description |
---|---|
Mutiny.Session |
clear()
Completely clear the session.
|
io.smallrye.mutiny.Uni<java.lang.Void> |
close()
Close the reactive session and release the underlying database
connection.
|
boolean |
contains(java.lang.Object entity)
Determine if the given instance belongs to this persistence context.
|
<T> javax.persistence.EntityGraph<T> |
createEntityGraph(java.lang.Class<T> entity)
Create a new mutable
EntityGraph |
<T> javax.persistence.EntityGraph<T> |
createEntityGraph(java.lang.Class<T> entity,
java.lang.String name)
Create a new mutable copy of a named
EntityGraph |
<R> Mutiny.Query<R> |
createNamedQuery(java.lang.String name)
Create an instance of
Mutiny.Query for the named query. |
<R> Mutiny.Query<R> |
createNamedQuery(java.lang.String name,
java.lang.Class<R> resultType)
Create an instance of
Mutiny.Query for the named query. |
<R> Mutiny.Query<R> |
createNativeQuery(java.lang.String sql)
Create an instance of
Mutiny.Query for the given SQL query string,
or SQL update, insert, or delete statement. |
<R> Mutiny.Query<R> |
createNativeQuery(java.lang.String sql,
AffectedEntities affectedEntities)
Create an instance of
Mutiny.Query for the given SQL query string,
or SQL update, insert, or delete statement. |
<R> Mutiny.Query<R> |
createNativeQuery(java.lang.String sql,
java.lang.Class<R> resultType)
Create an instance of
Mutiny.Query for the given SQL query
string, using the given resultType to interpret the results. |
<R> Mutiny.Query<R> |
createNativeQuery(java.lang.String sql,
java.lang.Class<R> resultType,
AffectedEntities affectedEntities)
Create an instance of
Mutiny.Query for the given SQL query
string, using the given resultType to interpret the results. |
<R> Mutiny.Query<R> |
createNativeQuery(java.lang.String sql,
ResultSetMapping<R> resultSetMapping)
Create an instance of
Mutiny.Query for the given SQL query string,
using the given ResultSetMapping to interpret the result set. |
<R> Mutiny.Query<R> |
createNativeQuery(java.lang.String sql,
ResultSetMapping<R> resultSetMapping,
AffectedEntities affectedEntities)
Create an instance of
Mutiny.Query for the given SQL query string,
using the given ResultSetMapping to interpret the result set. |
<R> Mutiny.Query<R> |
createQuery(javax.persistence.criteria.CriteriaDelete<R> criteriaDelete)
Create an instance of
Mutiny.Query for the given criteria delete. |
<R> Mutiny.Query<R> |
createQuery(javax.persistence.criteria.CriteriaQuery<R> criteriaQuery)
Create an instance of
Mutiny.Query for the given criteria query. |
<R> Mutiny.Query<R> |
createQuery(javax.persistence.criteria.CriteriaUpdate<R> criteriaUpdate)
Create an instance of
Mutiny.Query for the given criteria update. |
<R> Mutiny.Query<R> |
createQuery(java.lang.String jpql)
Create an instance of
Mutiny.Query for the given HQL/JPQL query
string or HQL/JPQL update or delete statement. |
<R> Mutiny.Query<R> |
createQuery(java.lang.String jpql,
java.lang.Class<R> resultType)
Create an instance of
Mutiny.Query for the given HQL/JPQL query
string. |
Mutiny.Transaction |
currentTransaction()
Obtain the transaction currently associated with this session,
if any.
|
Mutiny.Session |
detach(java.lang.Object entity)
Remove this instance from the session cache.
|
Mutiny.Session |
disableFetchProfile(java.lang.String name)
Disable a particular fetch profile on this session, or do nothing if
the requested fetch profile is not enabled.
|
void |
disableFilter(java.lang.String filterName)
Disable the named filter for this session.
|
Mutiny.Session |
enableFetchProfile(java.lang.String name)
Enable a particular fetch profile on this session, or do nothing if
requested fetch profile is already enabled.
|
org.hibernate.Filter |
enableFilter(java.lang.String filterName)
Enable the named filter for this session.
|
<E,T> io.smallrye.mutiny.Uni<T> |
fetch(E entity,
javax.persistence.metamodel.Attribute<E,T> field)
Fetch a lazy property of the given entity, identified by a JPA
attribute metamodel . |
<T> io.smallrye.mutiny.Uni<T> |
fetch(T association)
Asynchronously fetch an association that's configured for lazy loading.
|
<T> io.smallrye.mutiny.Uni<T> |
find(java.lang.Class<T> entityClass,
Identifier<T> id)
Asynchronously return the persistent instance of the given entity
class with the given natural identifier, or null if there is no
such persistent instance.
|
<T> io.smallrye.mutiny.Uni<java.util.List<T>> |
find(java.lang.Class<T> entityClass,
java.lang.Object... ids)
Asynchronously return the persistent instances of the given entity
class with the given identifiers, or null if there is no such
persistent instance.
|
<T> io.smallrye.mutiny.Uni<T> |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey)
Asynchronously return the persistent instance of the given entity
class with the given identifier, or
null if there is no such
persistent instance. |
<T> io.smallrye.mutiny.Uni<T> |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
org.hibernate.LockMode lockMode)
Asynchronously return the persistent instance of the given entity
class with the given identifier, requesting the given
LockMode . |
<T> io.smallrye.mutiny.Uni<T> |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
org.hibernate.LockOptions lockOptions) |
<T> io.smallrye.mutiny.Uni<T> |
find(javax.persistence.EntityGraph<T> entityGraph,
java.lang.Object id)
Asynchronously return the persistent instance with the given
identifier of an entity class, using the given
EntityGraph
as a fetch plan. |
io.smallrye.mutiny.Uni<java.lang.Void> |
flush()
Force this session to flush asynchronously.
|
java.lang.Integer |
getBatchSize()
The session-level JDBC batch size, or
null if it has not been
overridden. |
org.hibernate.CacheMode |
getCacheMode()
Get the current cache mode.
|
org.hibernate.Filter |
getEnabledFilter(java.lang.String filterName)
Retrieve a currently enabled filter by name.
|
<T> javax.persistence.EntityGraph<T> |
getEntityGraph(java.lang.Class<T> entity,
java.lang.String name)
Obtain a named
EntityGraph |
org.hibernate.FlushMode |
getFlushMode()
Get the current flush mode for this session.
|
org.hibernate.LockMode |
getLockMode(java.lang.Object entity)
Determine the current lock mode of the given entity.
|
<T> T |
getReference(java.lang.Class<T> entityClass,
java.lang.Object id)
Return the persistent instance of the given entity class with the
given identifier, assuming that the instance exists.
|
<T> T |
getReference(T entity)
Return the persistent instance with the same identity as the given
instance, which might be detached, assuming that the instance is
still persistent in the database.
|
<T> ResultSetMapping<T> |
getResultSetMapping(java.lang.Class<T> resultType,
java.lang.String mappingName)
Obtain a native SQL result set mapping defined via the annotation
SqlResultSetMapping . |
boolean |
isDefaultReadOnly() |
boolean |
isFetchProfileEnabled(java.lang.String name)
Determine if the fetch profile with the given name is enabled for this
session.
|
boolean |
isOpen() |
boolean |
isReadOnly(java.lang.Object entityOrProxy)
Is the specified entity or proxy read-only?
|
io.smallrye.mutiny.Uni<java.lang.Void> |
lock(java.lang.Object entity,
org.hibernate.LockMode lockMode)
Obtain the specified lock level upon the given object.
|
io.smallrye.mutiny.Uni<java.lang.Void> |
lock(java.lang.Object entity,
org.hibernate.LockOptions lockOptions) |
<T> io.smallrye.mutiny.Uni<T> |
merge(T entity)
Copy the state of the given object onto the persistent instance with
the same identifier.
|
<T> io.smallrye.mutiny.Uni<java.lang.Void> |
mergeAll(T... entity)
Merge multiple entity instances at once.
|
io.smallrye.mutiny.Uni<java.lang.Void> |
persist(java.lang.Object entity)
Asynchronously persist the given transient instance, first assigning
a generated identifier.
|
io.smallrye.mutiny.Uni<java.lang.Void> |
persistAll(java.lang.Object... entity)
Persist multiple transient entity instances at once.
|
io.smallrye.mutiny.Uni<java.lang.Void> |
refresh(java.lang.Object entity)
Re-read the state of the given instance from the underlying database.
|
io.smallrye.mutiny.Uni<java.lang.Void> |
refresh(java.lang.Object entity,
org.hibernate.LockMode lockMode)
Re-read the state of the given instance from the underlying database,
requesting the given
LockMode . |
io.smallrye.mutiny.Uni<java.lang.Void> |
refresh(java.lang.Object entity,
org.hibernate.LockOptions lockOptions) |
io.smallrye.mutiny.Uni<java.lang.Void> |
refreshAll(java.lang.Object... entity)
Refresh multiple entity instances at once.
|
io.smallrye.mutiny.Uni<java.lang.Void> |
remove(java.lang.Object entity)
Asynchronously remove a persistent instance from the datastore.
|
io.smallrye.mutiny.Uni<java.lang.Void> |
removeAll(java.lang.Object... entity)
Remove multiple entity instances at once.
|
Mutiny.Session |
setBatchSize(java.lang.Integer batchSize)
Set the session-level JDBC batch size, overriding the batch size set
by the configuration property
hibernate.jdbc.batch_size . |
Mutiny.Session |
setCacheMode(org.hibernate.CacheMode cacheMode)
Set the
cache mode for this session. |
Mutiny.Session |
setDefaultReadOnly(boolean readOnly)
Change the default for entities and proxies loaded into this session
from modifiable to read-only mode, or from modifiable to read-only mode.
|
Mutiny.Session |
setFlushMode(org.hibernate.FlushMode flushMode)
Set the
flush mode for this session. |
Mutiny.Session |
setReadOnly(java.lang.Object entityOrProxy,
boolean readOnly)
Set an unmodified persistent object to read-only mode, or a read-only
object to modifiable mode.
|
<T> io.smallrye.mutiny.Uni<T> |
unproxy(T association)
Asynchronously fetch an association that's configured for lazy loading,
and unwrap the underlying entity implementation from any proxy.
|
<T> io.smallrye.mutiny.Uni<T> |
withTransaction(java.util.function.Function<Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Performs the given work within the scope of a database transaction,
automatically flushing the session.
|
public MutinySessionImpl(ReactiveSession session, MutinySessionFactoryImpl factory)
public io.smallrye.mutiny.Uni<java.lang.Void> flush()
Mutiny.Session
session.flush().thenAccept(v -> print("done saving changes"));
flush
in interface Mutiny.Session
EntityManager.flush()
public <T> io.smallrye.mutiny.Uni<T> fetch(T association)
Mutiny.Session
session.fetch(author.getBook()).thenAccept(book -> print(book.getTitle()));
fetch
in interface Mutiny.Session
association
- a lazy-loaded associationUni
Mutiny.fetch(Object)
,
Hibernate.initialize(Object)
public <E,T> io.smallrye.mutiny.Uni<T> fetch(E entity, javax.persistence.metamodel.Attribute<E,T> field)
Mutiny.Session
attribute metamodel
. Note that this feature is
only supported in conjunction with the Hibernate bytecode enhancer.
session.fetch(book, Book_.isbn).thenAccept(isbn -> print(isbn))
fetch
in interface Mutiny.Session
public <T> io.smallrye.mutiny.Uni<T> unproxy(T association)
Mutiny.Session
session.unproxy(author.getBook()).thenAccept(book -> print(book.getTitle()));
unproxy
in interface Mutiny.Session
association
- a lazy-loaded associationUni
Hibernate.unproxy(Object)
public <T> T getReference(java.lang.Class<T> entityClass, java.lang.Object id)
Mutiny.Session
Mutiny.Session.fetch(Object)
.
You should not use this method to determine if an instance exists
(use Mutiny.Session.find(java.lang.Class<T>, java.lang.Object)
instead). Use this only to retrieve an instance
which you safely assume exists, where non-existence would be an
actual error.
getReference
in interface Mutiny.Session
entityClass
- a persistent classid
- a valid identifier of an existing persistent instance of the classEntityManager.getReference(Class, Object)
public <T> T getReference(T entity)
Mutiny.Session
Mutiny.Session.fetch(Object)
.getReference
in interface Mutiny.Session
entity
- a detached persistent instancepublic org.hibernate.LockMode getLockMode(java.lang.Object entity)
Mutiny.Session
getLockMode
in interface Mutiny.Session
public boolean contains(java.lang.Object entity)
Mutiny.Session
contains
in interface Mutiny.Session
public <T> io.smallrye.mutiny.Uni<T> find(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
Mutiny.Session
null
if there is no such
persistent instance. If the instance is already associated with
the session, return the associated instance. This method never
returns an uninitialized instance.
session.find(Book.class, id).map(book -> print(book.getTitle()));
find
in interface Mutiny.Session
entityClass
- The entity typeprimaryKey
- an identifierUni
EntityManager.find(Class, Object)
public <T> io.smallrye.mutiny.Uni<java.util.List<T>> find(java.lang.Class<T> entityClass, java.lang.Object... ids)
Mutiny.Session
find
in interface Mutiny.Session
entityClass
- The entity typeids
- the identifiersUni
public <T> io.smallrye.mutiny.Uni<T> find(java.lang.Class<T> entityClass, Identifier<T> id)
Mutiny.Session
find
in interface Mutiny.Session
entityClass
- The entity typeid
- the natural identifierUni
public <T> io.smallrye.mutiny.Uni<T> find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, org.hibernate.LockMode lockMode)
Mutiny.Session
LockMode
.find
in interface Mutiny.Session
entityClass
- The entity typeprimaryKey
- an identifierlockMode
- the requested LockMode
Uni
Mutiny.Session.find(Class,Object)
,
this discussion of lock modes
public <T> io.smallrye.mutiny.Uni<T> find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, org.hibernate.LockOptions lockOptions)
public <T> io.smallrye.mutiny.Uni<T> find(javax.persistence.EntityGraph<T> entityGraph, java.lang.Object id)
Mutiny.Session
EntityGraph
as a fetch plan.find
in interface Mutiny.Session
entityGraph
- an EntityGraph
specifying the entity
and associations to be fetchedid
- an identifierMutiny.Session.find(Class,Object)
public io.smallrye.mutiny.Uni<java.lang.Void> persist(java.lang.Object entity)
Mutiny.Session
This operation cascades to associated instances if the association is
mapped with CascadeType.PERSIST
.
session.persist(newBook).map(v -> session.flush());
persist
in interface Mutiny.Session
entity
- a transient instance of a persistent classEntityManager.persist(Object)
public io.smallrye.mutiny.Uni<java.lang.Void> persistAll(java.lang.Object... entity)
Mutiny.Session
persistAll
in interface Mutiny.Session
Mutiny.Session.persist(Object)
public io.smallrye.mutiny.Uni<java.lang.Void> remove(java.lang.Object entity)
Mutiny.Session
This operation cascades to associated instances if the association is
mapped with CascadeType.REMOVE
.
session.delete(book).thenAccept(v -> session.flush());
remove
in interface Mutiny.Session
entity
- the managed persistent instance to be removedEntityManager.remove(Object)
public io.smallrye.mutiny.Uni<java.lang.Void> removeAll(java.lang.Object... entity)
Mutiny.Session
removeAll
in interface Mutiny.Session
Mutiny.Session.remove(Object)
public <T> io.smallrye.mutiny.Uni<T> merge(T entity)
Mutiny.Session
This operation cascades to associated instances if the association is
mapped with CascadeType.MERGE
.
merge
in interface Mutiny.Session
entity
- a detached instance with state to be copiedEntityManager.merge(Object)
@SafeVarargs public final <T> io.smallrye.mutiny.Uni<java.lang.Void> mergeAll(T... entity)
Mutiny.Session
mergeAll
in interface Mutiny.Session
Mutiny.Session.merge(Object)
public io.smallrye.mutiny.Uni<java.lang.Void> refresh(java.lang.Object entity)
Mutiny.Session
refresh
in interface Mutiny.Session
entity
- a managed persistent instanceEntityManager.refresh(Object)
public io.smallrye.mutiny.Uni<java.lang.Void> refresh(java.lang.Object entity, org.hibernate.LockMode lockMode)
Mutiny.Session
LockMode
.refresh
in interface Mutiny.Session
entity
- a managed persistent entity instancelockMode
- the requested lock modeMutiny.Session.refresh(Object)
public io.smallrye.mutiny.Uni<java.lang.Void> refresh(java.lang.Object entity, org.hibernate.LockOptions lockOptions)
public io.smallrye.mutiny.Uni<java.lang.Void> refreshAll(java.lang.Object... entity)
Mutiny.Session
refreshAll
in interface Mutiny.Session
Mutiny.Session.refresh(Object)
public io.smallrye.mutiny.Uni<java.lang.Void> lock(java.lang.Object entity, org.hibernate.LockMode lockMode)
Mutiny.Session
LockMode.PESSIMISTIC_READ
,
LockMode.PESSIMISTIC_WRITE
,
LockMode.PESSIMISTIC_FORCE_INCREMENT
,
LockMode.OPTIMISTIC
, or
LockMode.OPTIMISTIC_FORCE_INCREMENT
.
org.hibernate.annotations.CascadeType#LOCK
.lock
in interface Mutiny.Session
entity
- a managed persistent instancelockMode
- the lock levelpublic io.smallrye.mutiny.Uni<java.lang.Void> lock(java.lang.Object entity, org.hibernate.LockOptions lockOptions)
public <R> Mutiny.Query<R> createQuery(java.lang.String jpql)
Mutiny.Session
Mutiny.Query
for the given HQL/JPQL query
string or HQL/JPQL update or delete statement. In the case of an
update or delete, the returned Mutiny.Query
must be executed using
Mutiny.Query.executeUpdate()
which returns an affected row count.createQuery
in interface Mutiny.Session
jpql
- The HQL/JPQL query, update or delete statementMutiny.Query
instance for manipulation and executionEntityManager.createQuery(String)
public <R> Mutiny.Query<R> createQuery(java.lang.String jpql, java.lang.Class<R> resultType)
Mutiny.Session
Mutiny.Query
for the given HQL/JPQL query
string.createQuery
in interface Mutiny.Session
jpql
- The HQL/JPQL queryresultType
- the Java type returned in each row of query resultsMutiny.Query
instance for manipulation and executionEntityManager.createQuery(String, Class)
public <R> Mutiny.Query<R> createNativeQuery(java.lang.String sql)
Mutiny.Session
Mutiny.Query
for the given SQL query string,
or SQL update, insert, or delete statement. In the case of an update,
insert, or delete, the returned Mutiny.Query
must be executed using
Mutiny.Query.executeUpdate()
which returns an affected row count.
In the case of a query:
Object[]
.createNativeQuery
in interface Mutiny.Session
sql
- The SQL select, update, insert, or delete statementpublic <R> Mutiny.Query<R> createNativeQuery(java.lang.String sql, java.lang.Class<R> resultType)
Mutiny.Session
Mutiny.Query
for the given SQL query
string, using the given resultType
to interpret the results.
Object
, or a built-in type
such as String
or Integer
, the result set must
have a single column, which will be returned as a scalar.
Object[]
, then the result set
must have multiple columns, which will be returned in arrays.
createNativeQuery
in interface Mutiny.Session
sql
- The SQL queryresultType
- the Java type returned in each row of query resultsMutiny.Query
instance for manipulation and executionEntityManager.createNativeQuery(String, Class)
public <R> Mutiny.Query<R> createNativeQuery(java.lang.String sql, ResultSetMapping<R> resultSetMapping)
Mutiny.Session
Mutiny.Query
for the given SQL query string,
using the given ResultSetMapping
to interpret the result set.createNativeQuery
in interface Mutiny.Session
sql
- The SQL queryresultSetMapping
- the result set mappingMutiny.Query
instance for manipulation and executionMutiny.Session.getResultSetMapping(Class, String)
,
EntityManager.createNativeQuery(String, String)
public <R> Mutiny.Query<R> createNativeQuery(java.lang.String sql, AffectedEntities affectedEntities)
Mutiny.Session
Mutiny.Query
for the given SQL query string,
or SQL update, insert, or delete statement. In the case of an update,
insert, or delete, the returned Mutiny.Query
must be executed using
Mutiny.Query.executeUpdate()
which returns an affected row count.
In the case of a query:
Object[]
.affected entities
are synchronized with
the database before execution of the statement.createNativeQuery
in interface Mutiny.Session
sql
- The SQL select, update, insert, or delete statementaffectedEntities
- The entities which are affected by the statementpublic <R> Mutiny.Query<R> createNativeQuery(java.lang.String sql, java.lang.Class<R> resultType, AffectedEntities affectedEntities)
Mutiny.Session
Mutiny.Query
for the given SQL query
string, using the given resultType
to interpret the results.
Object
, or a built-in type
such as String
or Integer
, the result set must
have a single column, which will be returned as a scalar.
Object[]
, then the result set
must have multiple columns, which will be returned in arrays.
affected entities
are synchronized with
the database before execution of the query.createNativeQuery
in interface Mutiny.Session
sql
- The SQL queryresultType
- the Java type returned in each row of query resultsaffectedEntities
- The entities which are affected by the queryMutiny.Query
instance for manipulation and executionEntityManager.createNativeQuery(String, Class)
public <R> Mutiny.Query<R> createNativeQuery(java.lang.String sql, ResultSetMapping<R> resultSetMapping, AffectedEntities affectedEntities)
Mutiny.Session
Mutiny.Query
for the given SQL query string,
using the given ResultSetMapping
to interpret the result set.
Any affected entities
are synchronized with the
database before execution of the query.
createNativeQuery
in interface Mutiny.Session
sql
- The SQL queryresultSetMapping
- the result set mappingaffectedEntities
- The entities which are affected by the queryMutiny.Query
instance for manipulation and executionMutiny.Session.getResultSetMapping(Class, String)
,
EntityManager.createNativeQuery(String, String)
public <R> Mutiny.Query<R> createNamedQuery(java.lang.String name)
Mutiny.Session
Mutiny.Query
for the named query.createNamedQuery
in interface Mutiny.Session
name
- The name of the queryMutiny.Query
instance for manipulation and executionEntityManager.createQuery(String)
public <R> Mutiny.Query<R> createNamedQuery(java.lang.String name, java.lang.Class<R> resultType)
Mutiny.Session
Mutiny.Query
for the named query.createNamedQuery
in interface Mutiny.Session
name
- The name of the queryresultType
- the Java type returned in each row of query resultsMutiny.Query
instance for manipulation and executionEntityManager.createQuery(String, Class)
public <R> Mutiny.Query<R> createQuery(javax.persistence.criteria.CriteriaQuery<R> criteriaQuery)
Mutiny.Session
Mutiny.Query
for the given criteria query.createQuery
in interface Mutiny.Session
criteriaQuery
- The CriteriaQuery
Mutiny.Query
instance for manipulation and executionEntityManager.createQuery(String)
public <R> Mutiny.Query<R> createQuery(javax.persistence.criteria.CriteriaUpdate<R> criteriaUpdate)
Mutiny.Session
Mutiny.Query
for the given criteria update.createQuery
in interface Mutiny.Session
criteriaUpdate
- The CriteriaUpdate
Mutiny.Query
instance for manipulation and executionEntityManager.createQuery(String)
public <R> Mutiny.Query<R> createQuery(javax.persistence.criteria.CriteriaDelete<R> criteriaDelete)
Mutiny.Session
Mutiny.Query
for the given criteria delete.createQuery
in interface Mutiny.Session
criteriaDelete
- The CriteriaDelete
Mutiny.Query
instance for manipulation and executionEntityManager.createQuery(String)
public org.hibernate.FlushMode getFlushMode()
Mutiny.Session
getFlushMode
in interface Mutiny.Session
public Mutiny.Session setFlushMode(org.hibernate.FlushMode flushMode)
Mutiny.Session
flush mode
for this session.
The flush mode determines the points at which the session is flushed. Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.
For a logically "read only" session, it is reasonable to set the session's
flush mode to FlushMode.MANUAL
at the start of the session (in
order to achieve some extra performance).
setFlushMode
in interface Mutiny.Session
flushMode
- the new flush modepublic Mutiny.Session setDefaultReadOnly(boolean readOnly)
Mutiny.Session
Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted.
setDefaultReadOnly
in interface Mutiny.Session
Session.setDefaultReadOnly(boolean)
public boolean isDefaultReadOnly()
isDefaultReadOnly
in interface Mutiny.Session
public Mutiny.Session setReadOnly(java.lang.Object entityOrProxy, boolean readOnly)
Mutiny.Session
setReadOnly
in interface Mutiny.Session
Session.setReadOnly(Object, boolean)
public boolean isReadOnly(java.lang.Object entityOrProxy)
Mutiny.Session
isReadOnly
in interface Mutiny.Session
Session.isReadOnly(Object)
public org.hibernate.CacheMode getCacheMode()
Mutiny.Session
getCacheMode
in interface Mutiny.Session
public Mutiny.Session setCacheMode(org.hibernate.CacheMode cacheMode)
Mutiny.Session
cache mode
for this session.
The cache mode determines the manner in which this session interacts with the second level cache.
setCacheMode
in interface Mutiny.Session
cacheMode
- The new cache mode.public Mutiny.Session setBatchSize(java.lang.Integer batchSize)
Mutiny.Session
hibernate.jdbc.batch_size
.setBatchSize
in interface Mutiny.Session
public java.lang.Integer getBatchSize()
Mutiny.Session
null
if it has not been
overridden.getBatchSize
in interface Mutiny.Session
public Mutiny.Session detach(java.lang.Object entity)
Mutiny.Session
This operation cascades to associated instances if the association is
mapped with CascadeType.DETACH
.
detach
in interface Mutiny.Session
entity
- The entity to evictEntityManager.detach(Object)
public Mutiny.Session clear()
Mutiny.Session
clear
in interface Mutiny.Session
EntityManager.clear()
public Mutiny.Session enableFetchProfile(java.lang.String name)
Mutiny.Session
enableFetchProfile
in interface Mutiny.Session
name
- The name of the fetch profile to be enabled.for discussion of this feature
public Mutiny.Session disableFetchProfile(java.lang.String name)
Mutiny.Session
disableFetchProfile
in interface Mutiny.Session
name
- The name of the fetch profile to be disabled.for discussion of this feature
public boolean isFetchProfileEnabled(java.lang.String name)
Mutiny.Session
isFetchProfileEnabled
in interface Mutiny.Session
name
- The name of the profile to be checked.for discussion of this feature
public <T> ResultSetMapping<T> getResultSetMapping(java.lang.Class<T> resultType, java.lang.String mappingName)
Mutiny.Session
SqlResultSetMapping
.getResultSetMapping
in interface Mutiny.Session
public <T> javax.persistence.EntityGraph<T> getEntityGraph(java.lang.Class<T> entity, java.lang.String name)
Mutiny.Session
EntityGraph
getEntityGraph
in interface Mutiny.Session
public <T> javax.persistence.EntityGraph<T> createEntityGraph(java.lang.Class<T> entity)
Mutiny.Session
EntityGraph
createEntityGraph
in interface Mutiny.Session
public <T> javax.persistence.EntityGraph<T> createEntityGraph(java.lang.Class<T> entity, java.lang.String name)
Mutiny.Session
EntityGraph
createEntityGraph
in interface Mutiny.Session
public org.hibernate.Filter enableFilter(java.lang.String filterName)
Mutiny.Session
enableFilter
in interface Mutiny.Session
filterName
- The name of the filter to be enabled.public void disableFilter(java.lang.String filterName)
Mutiny.Session
disableFilter
in interface Mutiny.Session
filterName
- The name of the filter to be disabled.public org.hibernate.Filter getEnabledFilter(java.lang.String filterName)
Mutiny.Session
getEnabledFilter
in interface Mutiny.Session
filterName
- The name of the filter to be retrieved.public <T> io.smallrye.mutiny.Uni<T> withTransaction(java.util.function.Function<Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Mutiny.Session
Mutiny.Transaction.markForRollback()
is called.
The resulting Mutiny.Transaction
object may also be obtained via
Mutiny.Session.currentTransaction()
.
withTransaction
in interface Mutiny.Session
work
- a function which accepts Mutiny.Transaction
and returns
the result of the work as a Uni
.Mutiny.SessionFactory.withTransaction(BiFunction)
public Mutiny.Transaction currentTransaction()
Mutiny.Session
currentTransaction
in interface Mutiny.Session
Mutiny.Transaction
, or null if no transaction
was started using Mutiny.Session.withTransaction(Function)
.Mutiny.Session.withTransaction(Function)
,
Mutiny.SessionFactory.withTransaction(BiFunction)
public io.smallrye.mutiny.Uni<java.lang.Void> close()
Mutiny.Session
close
in interface Mutiny.Closeable
close
in interface Mutiny.Session
public boolean isOpen()
isOpen
in interface Mutiny.Session
Mutiny.Session.close()
has been called