Class StageSessionFactoryImpl
- java.lang.Object
-
- org.hibernate.reactive.stage.impl.StageSessionFactoryImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,Implementor
,Stage.SessionFactory
public class StageSessionFactoryImpl extends java.lang.Object implements Stage.SessionFactory, Implementor
Implementation ofStage.SessionFactory
.Obtained by calling
EntityManagerFactory.unwrap(Class)
.
-
-
Constructor Summary
Constructors Constructor Description StageSessionFactoryImpl(org.hibernate.internal.SessionFactoryImpl delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Destroy the session factory and clean up its connection pool.org.hibernate.Cache
getCache()
Obtain theCache
object for managing the second-level cache.Context
getContext()
jakarta.persistence.criteria.CriteriaBuilder
getCriteriaBuilder()
jakarta.persistence.metamodel.Metamodel
getMetamodel()
Obtain the JPAMetamodel
for the persistence unit.org.hibernate.service.ServiceRegistry
getServiceRegistry()
org.hibernate.stat.Statistics
getStatistics()
Obtain theStatistics
object exposing factory-level metrics.java.lang.String
getUuid()
boolean
isOpen()
java.util.concurrent.CompletionStage<Stage.Session>
openSession()
Obtain a newreactive session
CompletionStage
, the main interaction point between the user's program and Hibernate Reactive.java.util.concurrent.CompletionStage<Stage.Session>
openSession(java.lang.String tenantId)
Obtain a newreactive session
CompletionStage
for a specified tenant.java.util.concurrent.CompletionStage<Stage.StatelessSession>
openStatelessSession()
Obtain areactive stateless session
CompletionStage
.java.util.concurrent.CompletionStage<Stage.StatelessSession>
openStatelessSession(java.lang.String tenantId)
Obtain areactive stateless session
CompletionStage
.<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 areactive session
for a specified tenant.<T> java.util.concurrent.CompletionStage<T>
withSession(java.util.function.Function<Stage.Session,java.util.concurrent.CompletionStage<T>> work)
Perform work using areactive 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 astateless session
.<T> java.util.concurrent.CompletionStage<T>
withStatelessSession(java.util.function.Function<Stage.StatelessSession,java.util.concurrent.CompletionStage<T>> work)
Perform work using astateless session
.<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 areactive session
within an associatedtransaction
.<T> java.util.concurrent.CompletionStage<T>
withStatelessTransaction(java.util.function.BiFunction<Stage.StatelessSession,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Perform work using areactive session
within an associatedtransaction
.<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 areactive session
for a specified tenant within an associatedtransaction
.<T> java.util.concurrent.CompletionStage<T>
withTransaction(java.util.function.BiFunction<Stage.Session,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Perform work using areactive session
within an associatedtransaction
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.reactive.stage.Stage.SessionFactory
withStatelessTransaction, withTransaction
-
-
-
-
Method Detail
-
getUuid
public java.lang.String getUuid()
- Specified by:
getUuid
in interfaceImplementor
-
getServiceRegistry
public org.hibernate.service.ServiceRegistry getServiceRegistry()
- Specified by:
getServiceRegistry
in interfaceImplementor
-
getContext
public Context getContext()
- Specified by:
getContext
in interfaceImplementor
-
openSession
public java.util.concurrent.CompletionStage<Stage.Session> openSession()
Description copied from interface:Stage.SessionFactory
Obtain a newreactive session
CompletionStage
, the main interaction point between the user's program and Hibernate Reactive.When the
CompletionStage
completes successfully it returns a newly created session.The client must explicitly close the session by calling
Stage.Closeable.close()
.- Specified by:
openSession
in interfaceStage.SessionFactory
- See Also:
Stage.SessionFactory.withSession(Function)
-
openSession
public java.util.concurrent.CompletionStage<Stage.Session> openSession(java.lang.String tenantId)
Description copied from interface:Stage.SessionFactory
Obtain a newreactive session
CompletionStage
for a specified tenant.When the
CompletionStage
completes successfully it returns a newly created session.The client must explicitly close the session by calling
Stage.Closeable.close()
.- Specified by:
openSession
in interfaceStage.SessionFactory
- Parameters:
tenantId
- the id of the tenant- See Also:
Stage.SessionFactory.withSession(Function)
-
openStatelessSession
public java.util.concurrent.CompletionStage<Stage.StatelessSession> openStatelessSession()
Description copied from interface:Stage.SessionFactory
Obtain areactive stateless session
CompletionStage
.When the
CompletionStage
completes successfully it returns a newly created session.The client must explicitly close the session by calling
Stage.StatelessSession.close()
.- Specified by:
openStatelessSession
in interfaceStage.SessionFactory
-
openStatelessSession
public java.util.concurrent.CompletionStage<Stage.StatelessSession> openStatelessSession(java.lang.String tenantId)
Description copied from interface:Stage.SessionFactory
Obtain areactive stateless session
CompletionStage
.When the
CompletionStage
completes successfully it returns a newly created session.The client must explicitly close the session by calling
Stage.StatelessSession.close()
.- Specified by:
openStatelessSession
in interfaceStage.SessionFactory
- Parameters:
tenantId
- the id of the tenant
-
withSession
public <T> java.util.concurrent.CompletionStage<T> withSession(java.util.function.Function<Stage.Session,java.util.concurrent.CompletionStage<T>> work)
Description copied from interface:Stage.SessionFactory
Perform work using areactive session
.- If there is already a session associated with the current reactive stream, then the work will be executed using that session.
- Otherwise, if there is no session associated with the current stream, a new session will be created.
The session will be closed automatically, but must be flushed explicitly if necessary.
- Specified by:
withSession
in interfaceStage.SessionFactory
- Parameters:
work
- a function which accepts the session and returns the result of the work as aCompletionStage
.
-
withSession
public <T> java.util.concurrent.CompletionStage<T> withSession(java.lang.String tenantId, java.util.function.Function<Stage.Session,java.util.concurrent.CompletionStage<T>> work)
Description copied from interface:Stage.SessionFactory
Perform work using areactive session
for a specified tenant.- If there is already a session associated with the current reactive stream, and the given tenant, then the work will be executed using that session.
- Otherwise, a new session will be created.
The session will be closed automatically, but must be flushed explicitly if necessary.
- Specified by:
withSession
in interfaceStage.SessionFactory
- Parameters:
tenantId
- the id of the tenantwork
- a function which accepts the session and returns the result of the work as aCompletionStage
.
-
withStatelessSession
public <T> java.util.concurrent.CompletionStage<T> withStatelessSession(java.util.function.Function<Stage.StatelessSession,java.util.concurrent.CompletionStage<T>> work)
Description copied from interface:Stage.SessionFactory
Perform work using astateless session
.- If there is already a stateless session associated with the current reactive stream, then the work will be executed using that session.
- Otherwise, if there is no stateless session associated with the current stream, a new stateless session will be created.
The session will be closed automatically.
- Specified by:
withStatelessSession
in interfaceStage.SessionFactory
- Parameters:
work
- a function which accepts the session and returns the result of the work as aCompletionStage
.
-
withStatelessSession
public <T> java.util.concurrent.CompletionStage<T> withStatelessSession(java.lang.String tenantId, java.util.function.Function<Stage.StatelessSession,java.util.concurrent.CompletionStage<T>> work)
Description copied from interface:Stage.SessionFactory
Perform work using astateless session
.- If there is already a stateless session associated with the current reactive stream, then the work will be executed using that session.
- Otherwise, if there is no stateless session associated with the current stream, a new stateless session will be created.
The session will be closed automatically.
- Specified by:
withStatelessSession
in interfaceStage.SessionFactory
- Parameters:
tenantId
- the id of the tenantwork
- a function which accepts the session and returns the result of the work as aCompletionStage
.
-
withTransaction
public <T> java.util.concurrent.CompletionStage<T> withTransaction(java.util.function.BiFunction<Stage.Session,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Description copied from interface:Stage.SessionFactory
Perform work using areactive session
within an associatedtransaction
.- If there is already a stateless session associated with the current reactive stream, then the work will be executed using that session.
- Otherwise, if there is no stateless session associated with the current stream, a new stateless session will be created.
The session will be
flushed
and closed automatically, and the transaction committed automatically.- Specified by:
withTransaction
in interfaceStage.SessionFactory
- Parameters:
work
- a function which accepts the session and transaction and returns the result of the work as aCompletionStage
.- See Also:
Stage.SessionFactory.withSession(Function)
,Stage.Session.withTransaction(Function)
-
withStatelessTransaction
public <T> java.util.concurrent.CompletionStage<T> withStatelessTransaction(java.util.function.BiFunction<Stage.StatelessSession,Stage.Transaction,java.util.concurrent.CompletionStage<T>> work)
Description copied from interface:Stage.SessionFactory
Perform work using areactive session
within an associatedtransaction
.- If there is already a stateless session associated with the current reactive stream, then the work will be executed using that session.
- Otherwise, if there is no stateless session associated with the current stream, a new stateless session will be created.
The session will be closed automatically, and the transaction committed automatically.
- Specified by:
withStatelessTransaction
in interfaceStage.SessionFactory
- Parameters:
work
- a function which accepts the stateless session and returns the result of the work as aCompletionStage
.- See Also:
Stage.SessionFactory.withStatelessSession(Function)
,Stage.StatelessSession.withTransaction(Function)
-
withTransaction
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)
Description copied from interface:Stage.SessionFactory
Perform work using areactive session
for a specified tenant within an associatedtransaction
.- If there is already a session associated with the current reactive stream and the given tenant, then the work will be executed using that session.
- Otherwise, if there is no stateless session associated with the current stream and the given tenant, a new stateless session will be created.
The session will be
flushed
and closed automatically, and the transaction committed automatically.- Specified by:
withTransaction
in interfaceStage.SessionFactory
- Parameters:
tenantId
- the id of the tenantwork
- a function which accepts the session and returns the result of the work as aCompletionStage
.- See Also:
Stage.SessionFactory.withSession(String, Function)
,Stage.Session.withTransaction(Function)
-
withStatelessTransaction
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)
Description copied from interface:Stage.SessionFactory
Perform work using areactive session
within an associatedtransaction
.- If there is already a stateless session associated with the current reactive stream and the given tenant, then the work will be executed using that session.
- Otherwise, if there is no stateless session associated with the current stream, a new stateless session will be created.
The session will be closed automatically, and the transaction committed automatically.
- Specified by:
withStatelessTransaction
in interfaceStage.SessionFactory
- Parameters:
tenantId
- the id of the tenantwork
- a function which accepts the stateless session and returns the result of the work as aCompletionStage
.- See Also:
Stage.SessionFactory.withStatelessSession(String, Function)
,Stage.StatelessSession.withTransaction(Function)
-
getMetamodel
public jakarta.persistence.metamodel.Metamodel getMetamodel()
Description copied from interface:Stage.SessionFactory
Obtain the JPAMetamodel
for the persistence unit.- Specified by:
getMetamodel
in interfaceStage.SessionFactory
-
getCache
public org.hibernate.Cache getCache()
Description copied from interface:Stage.SessionFactory
Obtain theCache
object for managing the second-level cache.- Specified by:
getCache
in interfaceStage.SessionFactory
-
getStatistics
public org.hibernate.stat.Statistics getStatistics()
Description copied from interface:Stage.SessionFactory
Obtain theStatistics
object exposing factory-level metrics.- Specified by:
getStatistics
in interfaceStage.SessionFactory
-
close
public void close()
Description copied from interface:Stage.SessionFactory
Destroy the session factory and clean up its connection pool.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceStage.SessionFactory
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfaceStage.SessionFactory
- Returns:
- false if
Stage.SessionFactory.close()
has been called
-
getCriteriaBuilder
public jakarta.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
- Specified by:
getCriteriaBuilder
in interfaceStage.SessionFactory
- Returns:
- an instance of
CriteriaBuilder
for creating criteria queries.
-
-