public class StageSessionFactoryImpl extends Object implements Stage.SessionFactory
Stage.SessionFactory
. Obtained by calling org.hibernate.SessionFactory#unwrap(Class)
.
Constructor and Description |
---|
StageSessionFactoryImpl(SessionFactoryImpl delegate) |
Modifier and Type | Method and Description |
---|---|
void | close() Destroy the session factory and clean up its connection pool. |
Cache | getCache() Obtain the Cache object for managing the second-level cache. |
CriteriaBuilder | getCriteriaBuilder() |
Metamodel | getMetamodel() Obtain the JPA Metamodel for the persistence unit. |
boolean | isOpen() |
(package private) CompletionStage<Stage.Session> | newSession() |
(package private) CompletionStage<Stage.Session> | newSession(String tenantId) |
(package private) CompletionStage<Stage.StatelessSession> | newStatelessSession() |
Stage.Session | openSession() Obtain a new reactive session , the main interaction point between the user's program and Hibernate Reactive. |
Stage.Session | openSession(String tenantId) Obtain a new reactive session for a specified tenant. |
Stage.StatelessSession | openStatelessSession() Obtain a reactive stateless session . |
<T> CompletionStage<T> | withSession(Function<Stage.Session,CompletionStage<T>> work) Perform work using a reactive session . |
<T> CompletionStage<T> | withSession(String tenantId, Function<Stage.Session,CompletionStage<T>> work) Perform work using a reactive session for a specified tenant. |
<T> CompletionStage<T> | withTransaction(BiFunction<Stage.Session,Stage.Transaction,CompletionStage<T>> work) Perform work using a reactive session within an associated transaction . |
<T> CompletionStage<T> | withTransaction(String tenantId, BiFunction<Stage.Session,Stage.Transaction,CompletionStage<T>> work) Perform work using a reactive session for a specified tenant within an associated transaction . |
public StageSessionFactoryImpl(SessionFactoryImpl delegate)
public Stage.Session openSession()
Stage.SessionFactory
reactive session
, the main interaction point between the user's program and Hibernate Reactive. The underlying database connection is obtained lazily when the returned Stage.Session
needs to access the database.
The client must explicitly close the session by calling Stage.Session.close()
.
openSession
in interface Stage.SessionFactory
Stage.SessionFactory.withSession(Function)
public Stage.Session openSession(String tenantId)
Stage.SessionFactory
reactive session
for a specified tenant. The underlying database connection is obtained lazily when the returned Stage.Session
needs to access the database.
The client must explicitly close the session by calling Stage.Session.close()
.
openSession
in interface Stage.SessionFactory
tenantId
- the id of the tenantStage.SessionFactory.withSession(Function)
public Stage.StatelessSession openStatelessSession()
Stage.SessionFactory
reactive stateless session
. The underlying database connection is obtained lazily when the returned Stage.StatelessSession
needs to access the database.
The client must explicitly close the session by calling Stage.StatelessSession.close()
.
openStatelessSession
in interface Stage.SessionFactory
CompletionStage<Stage.Session> newSession()
CompletionStage<Stage.Session> newSession(String tenantId)
CompletionStage<Stage.StatelessSession> newStatelessSession()
public <T> CompletionStage<T> withSession(Function<Stage.Session,CompletionStage<T>> work)
Stage.SessionFactory
reactive session
. The session will be closed automatically.
withSession
in interface Stage.SessionFactory
work
- a function which accepts the session and returns the result of the work as a CompletionStage
.public <T> CompletionStage<T> withSession(String tenantId, Function<Stage.Session,CompletionStage<T>> work)
Stage.SessionFactory
reactive session
for a specified tenant. The session will be closed automatically.
withSession
in interface Stage.SessionFactory
tenantId
- the id of the tenantwork
- a function which accepts the session and returns the result of the work as a CompletionStage
.public <T> CompletionStage<T> withTransaction(BiFunction<Stage.Session,Stage.Transaction,CompletionStage<T>> work)
Stage.SessionFactory
reactive session
within an associated transaction
. The session will be flushed
and closed automatically, and the transaction committed automatically.
withTransaction
in interface Stage.SessionFactory
work
- a function which accepts the session and returns the result of the work as a CompletionStage
.Stage.SessionFactory.withSession(Function)
, Stage.Session.withTransaction(Function)
public <T> CompletionStage<T> withTransaction(String tenantId, BiFunction<Stage.Session,Stage.Transaction,CompletionStage<T>> work)
Stage.SessionFactory
reactive session
for a specified tenant within an associated transaction
. The session will be flushed
and closed automatically, and the transaction committed automatically.
withTransaction
in interface Stage.SessionFactory
tenantId
- the id of the tenantwork
- a function which accepts the session and returns the result of the work as a CompletionStage
.Stage.SessionFactory.withSession(Function)
, Stage.Session.withTransaction(Function)
public CriteriaBuilder getCriteriaBuilder()
getCriteriaBuilder
in interface Stage.SessionFactory
CriteriaBuilder
for creating criteria queries.public Metamodel getMetamodel()
Stage.SessionFactory
Metamodel
for the persistence unit.getMetamodel
in interface Stage.SessionFactory
public Cache getCache()
Stage.SessionFactory
Cache
object for managing the second-level cache.getCache
in interface Stage.SessionFactory
public void close()
Stage.SessionFactory
close
in interface AutoCloseable
close
in interface Stage.SessionFactory
public boolean isOpen()
isOpen
in interface Stage.SessionFactory
Stage.SessionFactory.close()
has been called