public class StageSessionFactoryImpl extends java.lang.Object implements Stage.SessionFactory
Stage.SessionFactory
.
Obtained by calling EntityManagerFactory.unwrap(Class)
.
Constructor and Description |
---|
StageSessionFactoryImpl(org.hibernate.internal.SessionFactoryImpl delegate) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Destroy the session factory and clean up its connection pool.
|
org.hibernate.Cache |
getCache()
Obtain the
Cache object for managing the second-level
cache. |
javax.persistence.criteria.CriteriaBuilder |
getCriteriaBuilder() |
javax.persistence.metamodel.Metamodel |
getMetamodel()
Obtain the JPA
Metamodel for the persistence unit. |
boolean |
isOpen() |
Stage.Session |
openSession()
Obtain a new
reactive session , the main
interaction point between the user's program and Hibernate
Reactive. |
Stage.Session |
openSession(java.lang.String tenantId)
Obtain a new
reactive session for a
specified tenant. |
Stage.StatelessSession |
openStatelessSession()
Obtain a
reactive stateless session . |
Stage.StatelessSession |
openStatelessSession(java.lang.String tenantId)
Obtain a
reactive stateless session . |
<T> java.util.concurrent.CompletionStage<T> |
withSession(java.util.function.Function<Stage.Session,java.util.concurrent.CompletionStage<T>> work)
Perform work using a
reactive session . |
<T> java.util.concurrent.CompletionStage<T> |
withSession(java.lang.String tenantId,
java.util.function.Function<Stage.Session,java.util.concurrent.CompletionStage<T>> work)
Perform work using a
reactive session for a
specified tenant. |
<T> java.util.concurrent.CompletionStage<T> |
withStatelessSession(java.util.function.Function<Stage.StatelessSession,java.util.concurrent.CompletionStage<T>> work)
Perform work using a
stateless session . |
<T> java.util.concurrent.CompletionStage<T> |
withStatelessSession(java.lang.String tenantId,
java.util.function.Function<Stage.StatelessSession,java.util.concurrent.CompletionStage<T>> work)
Perform work using a
stateless session . |
<T> java.util.concurrent.CompletionStage<T> |
withStatelessTransaction(java.util.function.BiFunction<Stage.StatelessSession,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Perform work using a
reactive session within an
associated transaction . |
<T> java.util.concurrent.CompletionStage<T> |
withStatelessTransaction(java.lang.String tenantId,
java.util.function.BiFunction<Stage.StatelessSession,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Perform work using a
reactive session within an
associated transaction . |
<T> java.util.concurrent.CompletionStage<T> |
withTransaction(java.util.function.BiFunction<Stage.Session,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Perform work using a
reactive session within an
associated transaction . |
<T> java.util.concurrent.CompletionStage<T> |
withTransaction(java.lang.String tenantId,
java.util.function.BiFunction<Stage.Session,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Perform work using a
reactive session for a
specified tenant within an associated transaction . |
public StageSessionFactoryImpl(org.hibernate.internal.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(java.lang.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
public Stage.StatelessSession openStatelessSession(java.lang.String tenantId)
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
tenantId
- the id of the tenantpublic <T> java.util.concurrent.CompletionStage<T> withSession(java.util.function.Function<Stage.Session,java.util.concurrent.CompletionStage<T>> work)
Stage.SessionFactory
reactive session
.
The session will be closed automatically, but must be flushed explicitly if necessary.
withSession
in interface Stage.SessionFactory
work
- a function which accepts the session and returns
the result of the work as a CompletionStage
.public <T> java.util.concurrent.CompletionStage<T> withSession(java.lang.String tenantId, java.util.function.Function<Stage.Session,java.util.concurrent.CompletionStage<T>> work)
Stage.SessionFactory
reactive session
for a
specified tenant.
The session will be closed automatically, but must be flushed explicitly if necessary.
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> java.util.concurrent.CompletionStage<T> withStatelessSession(java.util.function.Function<Stage.StatelessSession,java.util.concurrent.CompletionStage<T>> work)
Stage.SessionFactory
stateless session
.
The session will be closed automatically.
withStatelessSession
in interface Stage.SessionFactory
work
- a function which accepts the session and returns
the result of the work as a CompletionStage
.public <T> java.util.concurrent.CompletionStage<T> withStatelessSession(java.lang.String tenantId, java.util.function.Function<Stage.StatelessSession,java.util.concurrent.CompletionStage<T>> work)
Stage.SessionFactory
stateless session
.
The session will be closed automatically.
withStatelessSession
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> java.util.concurrent.CompletionStage<T> withTransaction(java.util.function.BiFunction<Stage.Session,Stage.Transaction,java.util.concurrent.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> java.util.concurrent.CompletionStage<T> withStatelessTransaction(java.util.function.BiFunction<Stage.StatelessSession,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Stage.SessionFactory
reactive session
within an
associated transaction
.
The session will be closed automatically, and the transaction committed automatically.
withStatelessTransaction
in interface Stage.SessionFactory
work
- a function which accepts the stateless session and returns
the result of the work as a CompletionStage
.Stage.SessionFactory.withStatelessSession(Function)
,
Stage.StatelessSession.withTransaction(Function)
public <T> java.util.concurrent.CompletionStage<T> withTransaction(java.lang.String tenantId, java.util.function.BiFunction<Stage.Session,Stage.Transaction,java.util.concurrent.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(String, Function)
,
Stage.Session.withTransaction(Function)
public <T> java.util.concurrent.CompletionStage<T> withStatelessTransaction(java.lang.String tenantId, java.util.function.BiFunction<Stage.StatelessSession,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Stage.SessionFactory
reactive session
within an
associated transaction
.
The session will be closed automatically, and the transaction committed automatically.
withStatelessTransaction
in interface Stage.SessionFactory
tenantId
- the id of the tenantwork
- a function which accepts the stateless session and returns
the result of the work as a CompletionStage
.Stage.SessionFactory.withStatelessSession(String, Function)
,
Stage.StatelessSession.withTransaction(Function)
public javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
getCriteriaBuilder
in interface Stage.SessionFactory
CriteriaBuilder
for creating
criteria queries.public javax.persistence.metamodel.Metamodel getMetamodel()
Stage.SessionFactory
Metamodel
for the persistence unit.getMetamodel
in interface Stage.SessionFactory
public org.hibernate.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 java.lang.AutoCloseable
close
in interface Stage.SessionFactory
public boolean isOpen()
isOpen
in interface Stage.SessionFactory
Stage.SessionFactory.close()
has been called