public static interface Mutiny.SessionFactory extends AutoCloseable
reactive sessions.
A Mutiny.SessionFactory may be obtained from an instance of
EntityManagerFactory as follows:
Mutiny.SessionFactory sessionFactory =
createEntityManagerFactory("example")
.unwrap(Mutiny.SessionFactory.class);
Here, configuration properties must be specified in
persistence.xml.
Alternatively, a Mutiny.SessionFactory may be obtained via
programmatic configuration of Hibernate using:
Configuration configuration = new Configuration();
...
Mutiny.SessionFactory sessionFactory =
configuration.buildSessionFactory(
new ReactiveServiceRegistryBuilder()
.applySettings( configuration.getProperties() )
.build()
)
.unwrap(Mutiny.SessionFactory.class);
| 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. |
CriteriaBuilder |
getCriteriaBuilder() |
Metamodel |
getMetamodel()
Obtain the JPA
Metamodel for the persistence unit. |
boolean |
isOpen() |
io.smallrye.mutiny.Uni<Mutiny.Session> |
openSession()
Obtain a new
reactive session Uni, the main
interaction point between the user's program and Hibernate
Reactive. |
io.smallrye.mutiny.Uni<Mutiny.Session> |
openSession(String tenantId)
Obtain a new
reactive session Uni for a
specified tenant. |
io.smallrye.mutiny.Uni<Mutiny.StatelessSession> |
openStatelessSession()
Obtain a
reactive stateless session
Uni. |
io.smallrye.mutiny.Uni<Mutiny.StatelessSession> |
openStatelessSession(String tenantId)
Obtain a
reactive stateless session
Uni. |
<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> |
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> |
withStatelessSession(Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Perform work using a
stateless 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> |
withStatelessTransaction(BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Perform work using a
reactive session within an
associated transaction. |
default <T> io.smallrye.mutiny.Uni<T> |
withStatelessTransaction(Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Perform work using a
reactive session within an
associated transaction. |
<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 a
specified tenant within an associated transaction. |
<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
associated transaction. |
default <T> io.smallrye.mutiny.Uni<T> |
withTransaction(Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
Perform work using a
reactive session within an
associated transaction. |
<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 a
specified tenant within an associated transaction. |
io.smallrye.mutiny.Uni<Mutiny.Session> openSession()
reactive 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().
withSession(Function)io.smallrye.mutiny.Uni<Mutiny.Session> openSession(String tenantId)
reactive 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().
tenantId - the id of the tenantwithSession(Function)io.smallrye.mutiny.Uni<Mutiny.StatelessSession> openStatelessSession()
reactive 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().
withStatelessSession(Function)io.smallrye.mutiny.Uni<Mutiny.StatelessSession> openStatelessSession(String tenantId)
reactive 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().
tenantId - the id of the tenantwithStatelessSession(String, Function)<T> io.smallrye.mutiny.Uni<T> withSession(Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
reactive session.
The session will be closed automatically, but must be flushed explicitly if necessary.
work - a function which accepts the session and returns
the result of the work as a Uni.<T> io.smallrye.mutiny.Uni<T> withSession(String tenantId, Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
reactive session for
a specified tenant.
The session will be closed automatically, but must be flushed explicitly if necessary.
tenantId - the id of the tenantwork - a function which accepts the session and returns
the result of the work as a Uni.<T> io.smallrye.mutiny.Uni<T> withTransaction(BiFunction<Mutiny.Session,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
reactive session within an
associated transaction.
The session will be flushed and closed
automatically, and the transaction committed automatically.
work - a function which accepts the session and transaction
and returns the result of the work as a Uni.withSession(Function),
Mutiny.Session.withTransaction(Function)default <T> io.smallrye.mutiny.Uni<T> withTransaction(Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
reactive session within an
associated transaction.
The session will be flushed and closed
automatically, and the transaction committed automatically.
work - a function which accepts the session and returns
the result of the work as a Uni.withTransaction(BiFunction),
Mutiny.Session.withTransaction(Function)default <T> io.smallrye.mutiny.Uni<T> withStatelessTransaction(Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
reactive session within an
associated transaction.
The session will be closed automatically and the transaction committed automatically.
work - a function which accepts the stateless session and returns
the result of the work as a Uni.withStatelessSession(Function),
Mutiny.StatelessSession.withTransaction(Function)<T> io.smallrye.mutiny.Uni<T> withStatelessTransaction(BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
reactive session within an
associated transaction.
The session will be closed automatically and the transaction committed automatically.
work - a function which accepts the stateless session and returns
the result of the work as a Uni.withStatelessSession(Function),
Mutiny.StatelessSession.withTransaction(Function)<T> io.smallrye.mutiny.Uni<T> withStatelessSession(Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
stateless session.
The session will be closed automatically.
work - a function which accepts the session and returns
the result of the work as a Uni.<T> io.smallrye.mutiny.Uni<T> withStatelessSession(String tenantId, Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
stateless session.
The session will be closed automatically.
tenantId - the id of the tenantwork - a function which accepts the session and returns
the result of the work as a Uni.<T> io.smallrye.mutiny.Uni<T> withTransaction(String tenantId, BiFunction<Mutiny.Session,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
reactive session for a
specified tenant within an associated transaction.
The session will be flushed and closed
automatically, and the transaction committed automatically.
tenantId - the id of the tenantwork - a function which accepts the session and returns
the result of the work as a Uni.withSession(String, Function),
Mutiny.Session.withTransaction(Function)<T> io.smallrye.mutiny.Uni<T> withStatelessTransaction(String tenantId, BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
reactive session for a
specified tenant within an associated transaction.
The session will be closed automatically and the transaction committed automatically.
tenantId - the id of the tenantwork - a function which accepts the stateless session and returns
the result of the work as a Uni.withStatelessSession(String, Function),
Mutiny.StatelessSession.withTransaction(Function)CriteriaBuilder getCriteriaBuilder()
CriteriaBuilder for creating
criteria queries.org.hibernate.Cache getCache()
Cache object for managing the second-level
cache.void close()
close in interface AutoCloseableboolean isOpen()
close() has been calledCopyright © 2020-2022 Red Hat, Inc. All Rights Reserved.