Class MutinySessionFactoryImpl
- java.lang.Object
-
- org.hibernate.reactive.mutiny.impl.MutinySessionFactoryImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,Implementor
,Mutiny.SessionFactory
public class MutinySessionFactoryImpl extends java.lang.Object implements Mutiny.SessionFactory, Implementor
Implementation ofMutiny.SessionFactory
.Obtained by calling
EntityManagerFactory.unwrap(Class)
.
-
-
Constructor Summary
Constructors Constructor Description MutinySessionFactoryImpl(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()
io.smallrye.mutiny.Uni<Mutiny.Session>
openSession()
Obtain a newreactive session
Uni
, the main interaction point between the user's program and Hibernate Reactive.io.smallrye.mutiny.Uni<Mutiny.Session>
openSession(java.lang.String tenantId)
Obtain a newreactive session
Uni
for a specified tenant.io.smallrye.mutiny.Uni<Mutiny.StatelessSession>
openStatelessSession()
Obtain areactive stateless session
Uni
.io.smallrye.mutiny.Uni<Mutiny.StatelessSession>
openStatelessSession(java.lang.String tenantId)
Obtain areactive stateless session
Uni
.<T> io.smallrye.mutiny.Uni<T>
withSession(java.lang.String tenantId, java.util.function.Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
Perform work using areactive session
for a specified tenant.<T> io.smallrye.mutiny.Uni<T>
withSession(java.util.function.Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
Perform work using areactive session
.<T> io.smallrye.mutiny.Uni<T>
withStatelessSession(java.lang.String tenantId, java.util.function.Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Perform work using astateless session
.<T> io.smallrye.mutiny.Uni<T>
withStatelessSession(java.util.function.Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Perform work using astateless session
.<T> io.smallrye.mutiny.Uni<T>
withStatelessTransaction(java.lang.String tenantId, java.util.function.BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Perform work using areactive session
for a specified tenant within an associatedtransaction
.<T> io.smallrye.mutiny.Uni<T>
withStatelessTransaction(java.util.function.BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Perform work using areactive session
within an associatedtransaction
.<T> io.smallrye.mutiny.Uni<T>
withTransaction(java.lang.String tenantId, java.util.function.BiFunction<Mutiny.Session,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Perform work using areactive session
for a specified tenant within an associatedtransaction
.<T> io.smallrye.mutiny.Uni<T>
withTransaction(java.util.function.BiFunction<Mutiny.Session,Mutiny.Transaction,io.smallrye.mutiny.Uni<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.mutiny.Mutiny.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 io.smallrye.mutiny.Uni<Mutiny.Session> openSession()
Description copied from interface:Mutiny.SessionFactory
Obtain a newreactive session
Uni
, the main interaction point between the user's program and Hibernate Reactive.When the
Uni
completes successfully it returns a newly created session.The client must explicitly close the session by calling
Mutiny.Closeable.close()
.- Specified by:
openSession
in interfaceMutiny.SessionFactory
- See Also:
Mutiny.SessionFactory.withSession(Function)
-
openSession
public io.smallrye.mutiny.Uni<Mutiny.Session> openSession(java.lang.String tenantId)
Description copied from interface:Mutiny.SessionFactory
Obtain a newreactive session
Uni
for a specified tenant.When the
Uni
completes successfully it returns a newly created session.The client must explicitly close the session by calling
Mutiny.Closeable.close()
.- Specified by:
openSession
in interfaceMutiny.SessionFactory
- Parameters:
tenantId
- the id of the tenant- See Also:
Mutiny.SessionFactory.withSession(Function)
-
openStatelessSession
public io.smallrye.mutiny.Uni<Mutiny.StatelessSession> openStatelessSession()
Description copied from interface:Mutiny.SessionFactory
Obtain areactive stateless session
Uni
.When the
Uni
completes successfully it returns a newly created session.The client must explicitly close the session by calling
Mutiny.StatelessSession.close()
.- Specified by:
openStatelessSession
in interfaceMutiny.SessionFactory
- See Also:
Mutiny.SessionFactory.withStatelessSession(Function)
-
openStatelessSession
public io.smallrye.mutiny.Uni<Mutiny.StatelessSession> openStatelessSession(java.lang.String tenantId)
Description copied from interface:Mutiny.SessionFactory
Obtain areactive stateless session
Uni
.When the
Uni
completes successfully it returns a newly created session.The client must explicitly close the session by calling
Mutiny.StatelessSession.close()
.- Specified by:
openStatelessSession
in interfaceMutiny.SessionFactory
- Parameters:
tenantId
- the id of the tenant- See Also:
Mutiny.SessionFactory.withStatelessSession(String, Function)
-
withSession
public <T> io.smallrye.mutiny.Uni<T> withSession(java.util.function.Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
Description copied from interface:Mutiny.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 interfaceMutiny.SessionFactory
- Parameters:
work
- a function which accepts the session and returns the result of the work as aUni
.
-
withSession
public <T> io.smallrye.mutiny.Uni<T> withSession(java.lang.String tenantId, java.util.function.Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
Description copied from interface:Mutiny.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 interfaceMutiny.SessionFactory
- Parameters:
tenantId
- the id of the tenantwork
- a function which accepts the session and returns the result of the work as aUni
.
-
withStatelessSession
public <T> io.smallrye.mutiny.Uni<T> withStatelessSession(java.util.function.Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Description copied from interface:Mutiny.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 interfaceMutiny.SessionFactory
- Parameters:
work
- a function which accepts the session and returns the result of the work as aUni
.
-
withStatelessSession
public <T> io.smallrye.mutiny.Uni<T> withStatelessSession(java.lang.String tenantId, java.util.function.Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Description copied from interface:Mutiny.SessionFactory
Perform work using astateless session
.- If there is already a stateless session associated with the current reactive stream and given tenant id, then the work will be executed using that session.
- Otherwise, if there is no stateless session associated with the current stream and given tenant id, a new stateless session will be created.
The session will be closed automatically.
- Specified by:
withStatelessSession
in interfaceMutiny.SessionFactory
- Parameters:
tenantId
- the id of the tenantwork
- a function which accepts the session and returns the result of the work as aUni
.
-
withTransaction
public <T> io.smallrye.mutiny.Uni<T> withTransaction(java.util.function.BiFunction<Mutiny.Session,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Description copied from interface:Mutiny.SessionFactory
Perform work using areactive session
within an associatedtransaction
.- 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
flushed
and closed automatically, and the transaction committed automatically.- Specified by:
withTransaction
in interfaceMutiny.SessionFactory
- Parameters:
work
- a function which accepts the session and transaction and returns the result of the work as aUni
.- See Also:
Mutiny.SessionFactory.withSession(Function)
,Mutiny.Session.withTransaction(Function)
-
withStatelessTransaction
public <T> io.smallrye.mutiny.Uni<T> withStatelessTransaction(java.util.function.BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Description copied from interface:Mutiny.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 interfaceMutiny.SessionFactory
- Parameters:
work
- a function which accepts the stateless session and returns the result of the work as aUni
.- See Also:
Mutiny.SessionFactory.withStatelessSession(Function)
,Mutiny.StatelessSession.withTransaction(Function)
-
withTransaction
public <T> io.smallrye.mutiny.Uni<T> withTransaction(java.lang.String tenantId, java.util.function.BiFunction<Mutiny.Session,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Description copied from interface:Mutiny.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 given tenant id, then the work will be executed using that session.
- Otherwise, if there is no session associated with the current stream and given tenant id, a new stateless session will be created.
The session will be
flushed
and closed automatically, and the transaction committed automatically.- Specified by:
withTransaction
in interfaceMutiny.SessionFactory
- Parameters:
tenantId
- the id of the tenantwork
- a function which accepts the session and returns the result of the work as aUni
.- See Also:
Mutiny.SessionFactory.withSession(String, Function)
,Mutiny.Session.withTransaction(Function)
-
withStatelessTransaction
public <T> io.smallrye.mutiny.Uni<T> withStatelessTransaction(java.lang.String tenantId, java.util.function.BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Description copied from interface:Mutiny.SessionFactory
Perform work using areactive session
for a specified tenant within an associatedtransaction
.- If there is already a stateless session associated with the current reactive stream and given tenant id, then the work will be executed using that session.
- Otherwise, if there is no stateless session associated with the current stream and given tenant id, a new stateless session will be created.
The session will be closed automatically and the transaction committed automatically.
- Specified by:
withStatelessTransaction
in interfaceMutiny.SessionFactory
- Parameters:
tenantId
- the id of the tenantwork
- a function which accepts the stateless session and returns the result of the work as aUni
.- See Also:
Mutiny.SessionFactory.withStatelessSession(String, Function)
,Mutiny.StatelessSession.withTransaction(Function)
-
getCriteriaBuilder
public jakarta.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
- Specified by:
getCriteriaBuilder
in interfaceMutiny.SessionFactory
- Returns:
- an instance of
CriteriaBuilder
for creating criteria queries.
-
getMetamodel
public jakarta.persistence.metamodel.Metamodel getMetamodel()
Description copied from interface:Mutiny.SessionFactory
Obtain the JPAMetamodel
for the persistence unit.- Specified by:
getMetamodel
in interfaceMutiny.SessionFactory
-
getCache
public org.hibernate.Cache getCache()
Description copied from interface:Mutiny.SessionFactory
Obtain theCache
object for managing the second-level cache.- Specified by:
getCache
in interfaceMutiny.SessionFactory
-
getStatistics
public org.hibernate.stat.Statistics getStatistics()
Description copied from interface:Mutiny.SessionFactory
Obtain theStatistics
object exposing factory-level metrics.- Specified by:
getStatistics
in interfaceMutiny.SessionFactory
-
close
public void close()
Description copied from interface:Mutiny.SessionFactory
Destroy the session factory and clean up its connection pool.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceMutiny.SessionFactory
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfaceMutiny.SessionFactory
- Returns:
- false if
Mutiny.SessionFactory.close()
has been called
-
-