Class MutinySessionFactoryImpl
- All Implemented Interfaces:
AutoCloseable,Implementor,Mutiny.SessionFactory
Mutiny.SessionFactory.
Obtained by calling EntityManagerFactory.unwrap(Class).
-
Constructor Summary
ConstructorsConstructorDescriptionMutinySessionFactoryImpl(org.hibernate.internal.SessionFactoryImpl delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Destroy the session factory and clean up its connection pool.org.hibernate.CachegetCache()Obtain theCacheobject for managing the second-level cache.org.hibernate.query.criteria.HibernateCriteriaBuilderReturn the current instance ofMutiny.Session, if any.Return the current instance ofMutiny.Session, if any.jakarta.persistence.metamodel.MetamodelObtain the JPAMetamodelfor the persistence unit.org.hibernate.service.ServiceRegistryorg.hibernate.stat.StatisticsObtain theStatisticsobject exposing factory-level metrics.getUuid()booleanisOpen()io.smallrye.mutiny.Uni<Mutiny.Session>Obtain a newreactive sessionUni, the main interaction point between the user's program and Hibernate Reactive.io.smallrye.mutiny.Uni<Mutiny.Session>openSession(String tenantId) Obtain a newreactive sessionUnifor a specified tenant.io.smallrye.mutiny.Uni<Mutiny.StatelessSession>Obtain areactive stateless sessionUni.io.smallrye.mutiny.Uni<Mutiny.StatelessSession>openStatelessSession(String tenantId) Obtain areactive stateless sessionUni.<T> io.smallrye.mutiny.Uni<T>withSession(String tenantId, Function<Mutiny.Session, io.smallrye.mutiny.Uni<T>> work) Perform work using a reactive session for a specified tenant.<T> io.smallrye.mutiny.Uni<T>withSession(Function<Mutiny.Session, io.smallrye.mutiny.Uni<T>> work) Perform work using a reactive session.<T> io.smallrye.mutiny.Uni<T>withStatelessSession(String tenantId, Function<Mutiny.StatelessSession, io.smallrye.mutiny.Uni<T>> work) Perform work using a stateless session.<T> io.smallrye.mutiny.Uni<T>withStatelessSession(Function<Mutiny.StatelessSession, io.smallrye.mutiny.Uni<T>> work) Perform work using a stateless session.<T> io.smallrye.mutiny.Uni<T>withStatelessTransaction(String tenantId, BiFunction<Mutiny.StatelessSession, Mutiny.Transaction, io.smallrye.mutiny.Uni<T>> work) Perform work using a reactive session for the tenant with the specified tenant id within an associatedtransaction.<T> io.smallrye.mutiny.Uni<T>withStatelessTransaction(BiFunction<Mutiny.StatelessSession, Mutiny.Transaction, io.smallrye.mutiny.Uni<T>> work) Perform work using a reactive session within an associatedtransaction.<T> io.smallrye.mutiny.Uni<T>withTransaction(String tenantId, BiFunction<Mutiny.Session, Mutiny.Transaction, io.smallrye.mutiny.Uni<T>> work) Perform work using a reactive session for the tenant with the specified tenant id within an associatedtransaction.<T> io.smallrye.mutiny.Uni<T>withTransaction(BiFunction<Mutiny.Session, Mutiny.Transaction, io.smallrye.mutiny.Uni<T>> work) Perform work using a reactive session within an associatedtransaction.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.reactive.mutiny.Mutiny.SessionFactory
withStatelessTransaction, withTransaction
-
Constructor Details
-
MutinySessionFactoryImpl
public MutinySessionFactoryImpl(org.hibernate.internal.SessionFactoryImpl delegate)
-
-
Method Details
-
getUuid
- Specified by:
getUuidin interfaceImplementor
-
getServiceRegistry
public org.hibernate.service.ServiceRegistry getServiceRegistry()- Specified by:
getServiceRegistryin interfaceImplementor
-
getContext
- Specified by:
getContextin interfaceImplementor
-
openSession
Description copied from interface:Mutiny.SessionFactoryObtain a newreactive sessionUni, the main interaction point between the user's program and Hibernate Reactive.When the
Unicompletes successfully it returns a newly created session.The client must explicitly close the session by calling
Mutiny.Closeable.close().- Specified by:
openSessionin interfaceMutiny.SessionFactory- See Also:
-
openSession
Description copied from interface:Mutiny.SessionFactoryObtain a newreactive sessionUnifor a specified tenant.When the
Unicompletes successfully it returns a newly created session.The client must explicitly close the session by calling
Mutiny.Closeable.close().- Specified by:
openSessionin interfaceMutiny.SessionFactory- Parameters:
tenantId- the id of the tenant- See Also:
-
openStatelessSession
Description copied from interface:Mutiny.SessionFactoryObtain areactive stateless sessionUni.When the
Unicompletes successfully it returns a newly created session.The client must explicitly close the session by calling
Mutiny.StatelessSession.close().- Specified by:
openStatelessSessionin interfaceMutiny.SessionFactory- See Also:
-
openStatelessSession
Description copied from interface:Mutiny.SessionFactoryObtain areactive stateless sessionUni.When the
Unicompletes successfully it returns a newly created session.The client must explicitly close the session by calling
Mutiny.StatelessSession.close().- Specified by:
openStatelessSessionin interfaceMutiny.SessionFactory- Parameters:
tenantId- the id of the tenant- See Also:
-
getCurrentSession
Description copied from interface:Mutiny.SessionFactoryReturn the current instance ofMutiny.Session, if any. A current session exists only when this method is called from within an invocation ofMutiny.SessionFactory.withSession(Function)orMutiny.SessionFactory.withTransaction(Function).- Specified by:
getCurrentSessionin interfaceMutiny.SessionFactory- Returns:
- the current instance, if any, or
null
-
getCurrentStatelessSession
Description copied from interface:Mutiny.SessionFactoryReturn the current instance ofMutiny.Session, if any. A current session exists only when this method is called from within an invocation ofMutiny.SessionFactory.withStatelessSession(Function)orMutiny.SessionFactory.withStatelessTransaction(Function).- Specified by:
getCurrentStatelessSessionin interfaceMutiny.SessionFactory- Returns:
- the current instance, if any, or
null
-
withSession
public <T> io.smallrye.mutiny.Uni<T> withSession(Function<Mutiny.Session, io.smallrye.mutiny.Uni<T>> work) Description copied from interface:Mutiny.SessionFactoryPerform work using a reactive 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:
withSessionin 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(String tenantId, Function<Mutiny.Session, io.smallrye.mutiny.Uni<T>> work) Description copied from interface:Mutiny.SessionFactoryPerform work using a reactive 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:
withSessionin 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(Function<Mutiny.StatelessSession, io.smallrye.mutiny.Uni<T>> work) Description copied from interface:Mutiny.SessionFactoryPerform work using a stateless 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:
withStatelessSessionin 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(String tenantId, Function<Mutiny.StatelessSession, io.smallrye.mutiny.Uni<T>> work) Description copied from interface:Mutiny.SessionFactoryPerform work using a stateless 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:
withStatelessSessionin 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(BiFunction<Mutiny.Session, Mutiny.Transaction, io.smallrye.mutiny.Uni<T>> work) Description copied from interface:Mutiny.SessionFactoryPerform work using a reactive 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
flushedand closed automatically, and the transaction committed automatically.- Specified by:
withTransactionin interfaceMutiny.SessionFactory- Parameters:
work- a function which accepts the session and transaction and returns the result of the work as aUni.- See Also:
-
withStatelessTransaction
public <T> io.smallrye.mutiny.Uni<T> withStatelessTransaction(BiFunction<Mutiny.StatelessSession, Mutiny.Transaction, io.smallrye.mutiny.Uni<T>> work) Description copied from interface:Mutiny.SessionFactoryPerform work using a reactive 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:
withStatelessTransactionin interfaceMutiny.SessionFactory- Parameters:
work- a function which accepts the stateless session and returns the result of the work as aUni.- See Also:
-
withTransaction
public <T> io.smallrye.mutiny.Uni<T> withTransaction(String tenantId, BiFunction<Mutiny.Session, Mutiny.Transaction, io.smallrye.mutiny.Uni<T>> work) Description copied from interface:Mutiny.SessionFactoryPerform work using a reactive session for the tenant with the specified tenant id 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
flushedand closed automatically, and the transaction committed automatically.- Specified by:
withTransactionin 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:
-
withStatelessTransaction
public <T> io.smallrye.mutiny.Uni<T> withStatelessTransaction(String tenantId, BiFunction<Mutiny.StatelessSession, Mutiny.Transaction, io.smallrye.mutiny.Uni<T>> work) Description copied from interface:Mutiny.SessionFactoryPerform work using a reactive session for the tenant with the specified tenant id 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:
withStatelessTransactionin 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:
-
getCriteriaBuilder
public org.hibernate.query.criteria.HibernateCriteriaBuilder getCriteriaBuilder()- Specified by:
getCriteriaBuilderin interfaceMutiny.SessionFactory- Returns:
- an instance of
CriteriaBuilderfor creating criteria queries.
-
getMetamodel
public jakarta.persistence.metamodel.Metamodel getMetamodel()Description copied from interface:Mutiny.SessionFactoryObtain the JPAMetamodelfor the persistence unit.- Specified by:
getMetamodelin interfaceMutiny.SessionFactory
-
getCache
public org.hibernate.Cache getCache()Description copied from interface:Mutiny.SessionFactoryObtain theCacheobject for managing the second-level cache.- Specified by:
getCachein interfaceMutiny.SessionFactory
-
getStatistics
public org.hibernate.stat.Statistics getStatistics()Description copied from interface:Mutiny.SessionFactoryObtain theStatisticsobject exposing factory-level metrics.- Specified by:
getStatisticsin interfaceMutiny.SessionFactory
-
close
public void close()Description copied from interface:Mutiny.SessionFactoryDestroy the session factory and clean up its connection pool.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMutiny.SessionFactory
-
isOpen
public boolean isOpen()- Specified by:
isOpenin interfaceMutiny.SessionFactory- Returns:
- false if
Mutiny.SessionFactory.close()has been called
-