public class StageSessionImpl extends java.lang.Object implements Stage.Session
Stage.Session
API. This delegating class is
needed to avoid name clashes when implementing both
Session
and Session
.Constructor and Description |
---|
StageSessionImpl(ReactiveSession session,
StageSessionFactoryImpl factory) |
Modifier and Type | Method and Description |
---|---|
Stage.Session |
clear()
Completely clear the session.
|
java.util.concurrent.CompletionStage<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> Stage.Query<R> |
createNamedQuery(java.lang.String name)
Create an instance of
Stage.Query for the named query. |
<R> Stage.Query<R> |
createNamedQuery(java.lang.String name,
java.lang.Class<R> resultType)
Create an instance of
Stage.Query for the named query. |
<R> Stage.Query<R> |
createNativeQuery(java.lang.String sql)
Create an instance of
Stage.Query for the given SQL query string,
or SQL update, insert, or delete statement. |
<R> Stage.Query<R> |
createNativeQuery(java.lang.String sql,
AffectedEntities affectedEntities)
Create an instance of
Stage.Query for the given SQL query string,
or SQL update, insert, or delete statement. |
<R> Stage.Query<R> |
createNativeQuery(java.lang.String sql,
java.lang.Class<R> resultType)
Create an instance of
Stage.Query for the given SQL query string,
using the given resultType to interpret the results. |
<R> Stage.Query<R> |
createNativeQuery(java.lang.String sql,
java.lang.Class<R> resultType,
AffectedEntities affectedEntities)
Create an instance of
Stage.Query for the given SQL query string,
using the given resultType to interpret the results. |
<R> Stage.Query<R> |
createNativeQuery(java.lang.String sql,
ResultSetMapping<R> resultSetMapping)
Create an instance of
Stage.Query for the given SQL query string,
using the given ResultSetMapping to interpret the result set. |
<R> Stage.Query<R> |
createNativeQuery(java.lang.String sql,
ResultSetMapping<R> resultSetMapping,
AffectedEntities affectedEntities)
Create an instance of
Stage.Query for the given SQL query string,
using the given ResultSetMapping to interpret the result set. |
<R> Stage.Query<R> |
createQuery(javax.persistence.criteria.CriteriaDelete<R> criteriaDelete)
Create an instance of
Stage.Query for the given criteria delete. |
<R> Stage.Query<R> |
createQuery(javax.persistence.criteria.CriteriaQuery<R> criteriaQuery)
Create an instance of
Stage.Query for the given criteria query. |
<R> Stage.Query<R> |
createQuery(javax.persistence.criteria.CriteriaUpdate<R> criteriaUpdate)
Create an instance of
Stage.Query for the given criteria update. |
<R> Stage.Query<R> |
createQuery(java.lang.String jpql)
Create an instance of
Stage.Query for the given HQL/JPQL query
string or HQL/JPQL update or delete statement. |
<R> Stage.Query<R> |
createQuery(java.lang.String jpql,
java.lang.Class<R> resultType)
Create an instance of
Stage.Query for the given HQL/JPQL query
string. |
Stage.Transaction |
currentTransaction()
Obtain the transaction currently associated with this session,
if any.
|
Stage.Session |
detach(java.lang.Object entity)
Remove this instance from the session cache.
|
Stage.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.
|
Stage.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> java.util.concurrent.CompletionStage<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> java.util.concurrent.CompletionStage<T> |
fetch(T association)
Asynchronously fetch an association that's configured for lazy loading.
|
<T> java.util.concurrent.CompletionStage<T> |
find(java.lang.Class<T> entityClass,
Identifier<T> id)
Asynchronously return the persistent instance of the given entity
class with the given natural identifiers, or null if there is no
such persistent instance.
|
<T> java.util.concurrent.CompletionStage<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> java.util.concurrent.CompletionStage<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> java.util.concurrent.CompletionStage<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> java.util.concurrent.CompletionStage<T> |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
org.hibernate.LockOptions lockOptions) |
<T> java.util.concurrent.CompletionStage<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. |
java.util.concurrent.CompletionStage<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?
|
java.util.concurrent.CompletionStage<java.lang.Void> |
lock(java.lang.Object entity,
org.hibernate.LockMode lockMode)
Obtain the specified lock level upon the given object.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
lock(java.lang.Object entity,
org.hibernate.LockOptions lockOptions) |
<T> java.util.concurrent.CompletionStage<java.lang.Void> |
merge(T... entity)
Merge multiple entity instances at once.
|
<T> java.util.concurrent.CompletionStage<T> |
merge(T entity)
Copy the state of the given object onto the persistent instance with
the same identifier.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
persist(java.lang.Object... entity)
Persist multiple transient entity instances at once.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
persist(java.lang.Object entity)
Asynchronously persist the given transient instance, first assigning
a generated identifier.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
refresh(java.lang.Object... entity)
Refresh multiple entity instances at once.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
refresh(java.lang.Object entity)
Re-read the state of the given instance from the underlying database.
|
java.util.concurrent.CompletionStage<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 . |
java.util.concurrent.CompletionStage<java.lang.Void> |
refresh(java.lang.Object entity,
org.hibernate.LockOptions lockOptions) |
java.util.concurrent.CompletionStage<java.lang.Void> |
remove(java.lang.Object... entity)
Remove multiple entity instances at once.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
remove(java.lang.Object entity)
Asynchronously remove a persistent instance from the datastore.
|
Stage.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 . |
Stage.Session |
setCacheMode(org.hibernate.CacheMode cacheMode)
Set the
cache mode for this session. |
Stage.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.
|
Stage.Session |
setFlushMode(org.hibernate.FlushMode flushMode)
Set the
flush mode for this session. |
Stage.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> java.util.concurrent.CompletionStage<T> |
unproxy(T association)
Asynchronously fetch an association that's configured for lazy loading,
and unwrap the underlying entity implementation from any proxy.
|
<T> java.util.concurrent.CompletionStage<T> |
withTransaction(java.util.function.Function<Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Performs the given work within the scope of a database transaction,
automatically flushing the session.
|
public StageSessionImpl(ReactiveSession session, StageSessionFactoryImpl factory)
public java.util.concurrent.CompletionStage<java.lang.Void> flush()
Stage.Session
session.flush().thenAccept(v -> print("done saving changes"));
flush
in interface Stage.Session
EntityManager.flush()
public <T> java.util.concurrent.CompletionStage<T> fetch(T association)
Stage.Session
session.fetch(author.getBook()).thenAccept(book -> print(book.getTitle()))
fetch
in interface Stage.Session
association
- a lazy-loaded associationCompletionStage
Stage.fetch(Object)
,
Hibernate.initialize(Object)
public <E,T> java.util.concurrent.CompletionStage<T> fetch(E entity, javax.persistence.metamodel.Attribute<E,T> field)
Stage.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 Stage.Session
public <T> java.util.concurrent.CompletionStage<T> unproxy(T association)
Stage.Session
session.unproxy(author.getBook()).thenAccept(book -> print(book.getTitle()));
unproxy
in interface Stage.Session
association
- a lazy-loaded associationCompletionStage
Hibernate.unproxy(Object)
public <T> T getReference(java.lang.Class<T> entityClass, java.lang.Object id)
Stage.Session
Stage.Session.fetch(Object)
.
You should not use this method to determine if an instance exists
(use Stage.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 Stage.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)
Stage.Session
Stage.Session.fetch(Object)
.getReference
in interface Stage.Session
entity
- a detached persistent instancepublic org.hibernate.LockMode getLockMode(java.lang.Object entity)
Stage.Session
getLockMode
in interface Stage.Session
public boolean contains(java.lang.Object entity)
Stage.Session
contains
in interface Stage.Session
public <T> java.util.concurrent.CompletionStage<T> find(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
Stage.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).thenAccept(book -> print(book.getTitle()));
find
in interface Stage.Session
entityClass
- The entity typeprimaryKey
- an identifierCompletionStage
EntityManager.find(Class, Object)
public <T> java.util.concurrent.CompletionStage<java.util.List<T>> find(java.lang.Class<T> entityClass, java.lang.Object... ids)
Stage.Session
find
in interface Stage.Session
entityClass
- The entity typeids
- the identifiersCompletionStage
public <T> java.util.concurrent.CompletionStage<T> find(java.lang.Class<T> entityClass, Identifier<T> id)
Stage.Session
find
in interface Stage.Session
entityClass
- The entity typeid
- the natural identifierCompletionStage
public <T> java.util.concurrent.CompletionStage<T> find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, org.hibernate.LockMode lockMode)
Stage.Session
LockMode
.find
in interface Stage.Session
entityClass
- The entity typeprimaryKey
- an identifierlockMode
- the requested LockMode
CompletionStage
Stage.Session.find(Class,Object)
,
this discussion of lock modes
public <T> java.util.concurrent.CompletionStage<T> find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, org.hibernate.LockOptions lockOptions)
public <T> java.util.concurrent.CompletionStage<T> find(javax.persistence.EntityGraph<T> entityGraph, java.lang.Object id)
Stage.Session
EntityGraph
as a fetch plan.find
in interface Stage.Session
entityGraph
- an EntityGraph
specifying the entity
and associations to be fetchedid
- an identifierStage.Session.find(Class,Object)
public java.util.concurrent.CompletionStage<java.lang.Void> persist(java.lang.Object entity)
Stage.Session
This operation cascades to associated instances if the association is
mapped with CascadeType.PERSIST
.
session.persist(newBook).thenAccept(v -> session.flush());
persist
in interface Stage.Session
entity
- a transient instance of a persistent classEntityManager.persist(Object)
public java.util.concurrent.CompletionStage<java.lang.Void> persist(java.lang.Object... entity)
Stage.Session
persist
in interface Stage.Session
Stage.Session.persist(Object)
public java.util.concurrent.CompletionStage<java.lang.Void> remove(java.lang.Object entity)
Stage.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 Stage.Session
entity
- the managed persistent instance to be removedEntityManager.remove(Object)
public java.util.concurrent.CompletionStage<java.lang.Void> remove(java.lang.Object... entity)
Stage.Session
remove
in interface Stage.Session
Stage.Session.remove(Object)
public <T> java.util.concurrent.CompletionStage<T> merge(T entity)
Stage.Session
This operation cascades to associated instances if the association is
mapped with CascadeType.MERGE
.
merge
in interface Stage.Session
entity
- a detached instance with state to be copiedEntityManager.merge(Object)
@SafeVarargs public final <T> java.util.concurrent.CompletionStage<java.lang.Void> merge(T... entity)
Stage.Session
merge
in interface Stage.Session
Stage.Session.merge(Object)
public java.util.concurrent.CompletionStage<java.lang.Void> refresh(java.lang.Object entity)
Stage.Session
refresh
in interface Stage.Session
entity
- a managed persistent instanceEntityManager.refresh(Object)
public java.util.concurrent.CompletionStage<java.lang.Void> refresh(java.lang.Object entity, org.hibernate.LockMode lockMode)
Stage.Session
LockMode
.refresh
in interface Stage.Session
entity
- a managed persistent entity instancelockMode
- the requested lock modeStage.Session.refresh(Object)
public java.util.concurrent.CompletionStage<java.lang.Void> refresh(java.lang.Object entity, org.hibernate.LockOptions lockOptions)
public java.util.concurrent.CompletionStage<java.lang.Void> refresh(java.lang.Object... entity)
Stage.Session
refresh
in interface Stage.Session
Stage.Session.refresh(Object)
public java.util.concurrent.CompletionStage<java.lang.Void> lock(java.lang.Object entity, org.hibernate.LockMode lockMode)
Stage.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 Stage.Session
entity
- a managed persistent instancelockMode
- the lock levelpublic java.util.concurrent.CompletionStage<java.lang.Void> lock(java.lang.Object entity, org.hibernate.LockOptions lockOptions)
public <R> Stage.Query<R> createQuery(java.lang.String jpql)
Stage.Session
Stage.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 Stage.Query
must be executed using
Stage.Query.executeUpdate()
which returns an affected row count.createQuery
in interface Stage.Session
jpql
- The HQL/JPQL query, update or delete statementStage.Query
instance for manipulation and executionEntityManager.createQuery(String)
public <R> Stage.Query<R> createQuery(java.lang.String jpql, java.lang.Class<R> resultType)
Stage.Session
Stage.Query
for the given HQL/JPQL query
string.createQuery
in interface Stage.Session
jpql
- The HQL/JPQL queryresultType
- the Java type returned in each row of query resultsStage.Query
instance for manipulation and executionEntityManager.createQuery(String, Class)
public <R> Stage.Query<R> createNativeQuery(java.lang.String sql)
Stage.Session
Stage.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 Stage.Query
must be executed using
Stage.Query.executeUpdate()
which returns an affected row count.
In the case of a query:
Object[]
.createNativeQuery
in interface Stage.Session
sql
- The SQL select, update, insert, or delete statementpublic <R> Stage.Query<R> createNativeQuery(java.lang.String sql, java.lang.Class<R> resultType)
Stage.Session
Stage.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 as elements of
arrays of type Object[]
.createNativeQuery
in interface Stage.Session
sql
- The SQL queryresultType
- the Java type returned in each row of query resultsStage.Query
instance for manipulation and executionEntityManager.createNativeQuery(String, Class)
public <R> Stage.Query<R> createNativeQuery(java.lang.String sql, ResultSetMapping<R> resultSetMapping)
Stage.Session
Stage.Query
for the given SQL query string,
using the given ResultSetMapping
to interpret the result set.createNativeQuery
in interface Stage.Session
sql
- The SQL queryresultSetMapping
- the result set mappingStage.Query
instance for manipulation and executionStage.Session.getResultSetMapping(Class, String)
,
EntityManager.createNativeQuery(String, String)
public <R> Stage.Query<R> createNativeQuery(java.lang.String sql, java.lang.Class<R> resultType, AffectedEntities affectedEntities)
Stage.Session
Stage.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 as elements of
arrays of type Object[]
.affected entities
are synchronized with
the database before execution of the query.createNativeQuery
in interface Stage.Session
sql
- The SQL queryresultType
- the Java type returned in each row of query resultsaffectedEntities
- The entities which are affected by the queryStage.Query
instance for manipulation and executionEntityManager.createNativeQuery(String, Class)
public <R> Stage.Query<R> createNativeQuery(java.lang.String sql, ResultSetMapping<R> resultSetMapping, AffectedEntities affectedEntities)
Stage.Session
Stage.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 Stage.Session
sql
- The SQL queryresultSetMapping
- the result set mappingaffectedEntities
- The entities which are affected by the queryStage.Query
instance for manipulation and executionStage.Session.getResultSetMapping(Class, String)
,
EntityManager.createNativeQuery(String, String)
public <R> Stage.Query<R> createNativeQuery(java.lang.String sql, AffectedEntities affectedEntities)
Stage.Session
Stage.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 Stage.Query
must be executed using
Stage.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 Stage.Session
sql
- The SQL select, update, insert, or delete statementaffectedEntities
- The entities which are affected by the statementpublic <R> Stage.Query<R> createNamedQuery(java.lang.String name)
Stage.Session
Stage.Query
for the named query.createNamedQuery
in interface Stage.Session
name
- The name of the queryStage.Query
instance for manipulation and executionEntityManager.createQuery(String)
public <R> Stage.Query<R> createNamedQuery(java.lang.String name, java.lang.Class<R> resultType)
Stage.Session
Stage.Query
for the named query.createNamedQuery
in interface Stage.Session
name
- The name of the queryresultType
- the Java type returned in each row of query resultsStage.Query
instance for manipulation and executionEntityManager.createQuery(String, Class)
public <R> Stage.Query<R> createQuery(javax.persistence.criteria.CriteriaQuery<R> criteriaQuery)
Stage.Session
Stage.Query
for the given criteria query.createQuery
in interface Stage.Session
criteriaQuery
- The CriteriaQuery
Stage.Query
instance for manipulation and executionEntityManager.createQuery(String)
public <R> Stage.Query<R> createQuery(javax.persistence.criteria.CriteriaUpdate<R> criteriaUpdate)
Stage.Session
Stage.Query
for the given criteria update.createQuery
in interface Stage.Session
criteriaUpdate
- The CriteriaUpdate
Stage.Query
instance for manipulation and executionEntityManager.createQuery(String)
public <R> Stage.Query<R> createQuery(javax.persistence.criteria.CriteriaDelete<R> criteriaDelete)
Stage.Session
Stage.Query
for the given criteria delete.createQuery
in interface Stage.Session
criteriaDelete
- The CriteriaDelete
Stage.Query
instance for manipulation and executionEntityManager.createQuery(String)
public org.hibernate.FlushMode getFlushMode()
Stage.Session
getFlushMode
in interface Stage.Session
public Stage.Session setFlushMode(org.hibernate.FlushMode flushMode)
Stage.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 Stage.Session
flushMode
- the new flush modepublic Stage.Session setDefaultReadOnly(boolean readOnly)
Stage.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 Stage.Session
Session.setDefaultReadOnly(boolean)
public boolean isDefaultReadOnly()
isDefaultReadOnly
in interface Stage.Session
public Stage.Session setReadOnly(java.lang.Object entityOrProxy, boolean readOnly)
Stage.Session
setReadOnly
in interface Stage.Session
Session.setReadOnly(Object, boolean)
public boolean isReadOnly(java.lang.Object entityOrProxy)
Stage.Session
isReadOnly
in interface Stage.Session
Session.isReadOnly(Object)
public org.hibernate.CacheMode getCacheMode()
Stage.Session
getCacheMode
in interface Stage.Session
public Stage.Session setCacheMode(org.hibernate.CacheMode cacheMode)
Stage.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 Stage.Session
cacheMode
- The new cache mode.public Stage.Session setBatchSize(java.lang.Integer batchSize)
Stage.Session
hibernate.jdbc.batch_size
.setBatchSize
in interface Stage.Session
public java.lang.Integer getBatchSize()
Stage.Session
null
if it has not been
overridden.getBatchSize
in interface Stage.Session
public Stage.Session detach(java.lang.Object entity)
Stage.Session
This operation cascades to associated instances if the association is
mapped with CascadeType.DETACH
.
detach
in interface Stage.Session
entity
- The entity to evictEntityManager.detach(Object)
public Stage.Session clear()
Stage.Session
clear
in interface Stage.Session
EntityManager.clear()
public Stage.Session enableFetchProfile(java.lang.String name)
Stage.Session
enableFetchProfile
in interface Stage.Session
name
- The name of the fetch profile to be enabled.for discussion of this feature
public Stage.Session disableFetchProfile(java.lang.String name)
Stage.Session
disableFetchProfile
in interface Stage.Session
name
- The name of the fetch profile to be disabled.for discussion of this feature
public boolean isFetchProfileEnabled(java.lang.String name)
Stage.Session
isFetchProfileEnabled
in interface Stage.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)
Stage.Session
SqlResultSetMapping
.getResultSetMapping
in interface Stage.Session
public <T> javax.persistence.EntityGraph<T> getEntityGraph(java.lang.Class<T> entity, java.lang.String name)
Stage.Session
EntityGraph
getEntityGraph
in interface Stage.Session
public <T> javax.persistence.EntityGraph<T> createEntityGraph(java.lang.Class<T> entity)
Stage.Session
EntityGraph
createEntityGraph
in interface Stage.Session
public <T> javax.persistence.EntityGraph<T> createEntityGraph(java.lang.Class<T> entity, java.lang.String name)
Stage.Session
EntityGraph
createEntityGraph
in interface Stage.Session
public org.hibernate.Filter enableFilter(java.lang.String filterName)
Stage.Session
enableFilter
in interface Stage.Session
filterName
- The name of the filter to be enabled.public void disableFilter(java.lang.String filterName)
Stage.Session
disableFilter
in interface Stage.Session
filterName
- The name of the filter to be disabled.public org.hibernate.Filter getEnabledFilter(java.lang.String filterName)
Stage.Session
getEnabledFilter
in interface Stage.Session
filterName
- The name of the filter to be retrieved.public <T> java.util.concurrent.CompletionStage<T> withTransaction(java.util.function.Function<Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Stage.Session
Stage.Transaction.markForRollback()
is called.
The resulting Stage.Transaction
object may also be obtained via
Stage.Session.currentTransaction()
.
withTransaction
in interface Stage.Session
work
- a function which accepts Stage.Transaction
and returns
the result of the work as a CompletionStage
.Stage.SessionFactory.withTransaction(BiFunction)
public Stage.Transaction currentTransaction()
Stage.Session
currentTransaction
in interface Stage.Session
Stage.Transaction
, or null if no transaction
was started using Stage.Session.withTransaction(Function)
.Stage.Session.withTransaction(Function)
,
Stage.SessionFactory.withTransaction(BiFunction)
public java.util.concurrent.CompletionStage<java.lang.Void> close()
Stage.Session
close
in interface Stage.Closeable
close
in interface Stage.Session
public boolean isOpen()
isOpen
in interface Stage.Session
Stage.Session.close()
has been called