public class MutinySessionFactoryImpl extends java.lang.Object implements Mutiny.SessionFactory
Mutiny.SessionFactory
.
Obtained by calling EntityManagerFactory.unwrap(Class)
.
Constructor and Description |
---|
MutinySessionFactoryImpl(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() |
Mutiny.Session |
openSession()
Obtain a new
reactive session , the main
interaction point between the user's program and Hibernate
Reactive. |
Mutiny.Session |
openSession(java.lang.String tenantId)
Obtain a new
reactive session for a
specified tenant. |
Mutiny.StatelessSession |
openStatelessSession()
Obtain a
reactive stateless session . |
Mutiny.StatelessSession |
openStatelessSession(java.lang.String tenantId)
Obtain a
reactive stateless session . |
<T> io.smallrye.mutiny.Uni<T> |
withSession(java.util.function.Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
Perform work using a
reactive session . |
<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 a
reactive session for
a specified tenant. |
<T> io.smallrye.mutiny.Uni<T> |
withStatelessSession(java.util.function.Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Perform work using a
stateless 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 a
stateless session . |
<T> io.smallrye.mutiny.Uni<T> |
withStatelessTransaction(java.util.function.BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Perform work using a
reactive session within an
associated transaction . |
<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 a
reactive session for a
specified tenant within an associated transaction . |
<T> io.smallrye.mutiny.Uni<T> |
withTransaction(java.util.function.BiFunction<Mutiny.Session,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Perform work using a
reactive session within an
associated transaction . |
<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 a
reactive session for a
specified tenant within an associated transaction . |
public MutinySessionFactoryImpl(org.hibernate.internal.SessionFactoryImpl delegate)
public Mutiny.Session openSession()
Mutiny.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 Mutiny.Session
needs to access the database.
The client must explicitly close the session by calling
Mutiny.Session.close()
.
openSession
in interface Mutiny.SessionFactory
Mutiny.SessionFactory.withSession(Function)
public Mutiny.Session openSession(java.lang.String tenantId)
Mutiny.SessionFactory
reactive session
for a
specified tenant.
The underlying database connection is obtained lazily when
the returned Mutiny.Session
needs to access the database.
The client must explicitly close the session by calling
Mutiny.Session.close()
.
openSession
in interface Mutiny.SessionFactory
tenantId
- the id of the tenantMutiny.SessionFactory.withSession(Function)
public Mutiny.StatelessSession openStatelessSession()
Mutiny.SessionFactory
reactive stateless session
.
The underlying database connection is obtained lazily when
the returned Mutiny.StatelessSession
needs to access the
database.
The client must explicitly close the session by calling
Mutiny.StatelessSession.close()
.
openStatelessSession
in interface Mutiny.SessionFactory
public Mutiny.StatelessSession openStatelessSession(java.lang.String tenantId)
Mutiny.SessionFactory
reactive stateless session
.
The underlying database connection is obtained lazily when
the returned Mutiny.StatelessSession
needs to access the
database.
The client must explicitly close the session by calling
Mutiny.StatelessSession.close()
.
openStatelessSession
in interface Mutiny.SessionFactory
tenantId
- the id of the tenantpublic <T> io.smallrye.mutiny.Uni<T> withSession(java.util.function.Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
Mutiny.SessionFactory
reactive session
.
The session will be closed automatically, but must be flushed explicitly if necessary.
withSession
in interface Mutiny.SessionFactory
work
- a function which accepts the session and returns
the result of the work as a Uni
.public <T> io.smallrye.mutiny.Uni<T> withSession(java.lang.String tenantId, java.util.function.Function<Mutiny.Session,io.smallrye.mutiny.Uni<T>> work)
Mutiny.SessionFactory
reactive session
for
a specified tenant.
The session will be closed automatically, but must be flushed explicitly if necessary.
withSession
in interface Mutiny.SessionFactory
tenantId
- the id of the tenantwork
- a function which accepts the session and returns
the result of the work as a Uni
.public <T> io.smallrye.mutiny.Uni<T> withStatelessSession(java.util.function.Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Mutiny.SessionFactory
stateless session
.
The session will be closed automatically.
withStatelessSession
in interface Mutiny.SessionFactory
work
- a function which accepts the session and returns
the result of the work as a Uni
.public <T> io.smallrye.mutiny.Uni<T> withStatelessSession(java.lang.String tenantId, java.util.function.Function<Mutiny.StatelessSession,io.smallrye.mutiny.Uni<T>> work)
Mutiny.SessionFactory
stateless session
.
The session will be closed automatically.
withStatelessSession
in interface Mutiny.SessionFactory
tenantId
- the id of the tenantwork
- a function which accepts the session and returns
the result of the work as a Uni
.public <T> io.smallrye.mutiny.Uni<T> withTransaction(java.util.function.BiFunction<Mutiny.Session,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Mutiny.SessionFactory
reactive session
within an
associated transaction
.
The session will be flushed
and closed
automatically, and the transaction committed automatically.
withTransaction
in interface Mutiny.SessionFactory
work
- a function which accepts the session and returns
the result of the work as a Uni
.Mutiny.SessionFactory.withSession(Function)
,
Mutiny.Session.withTransaction(Function)
public <T> io.smallrye.mutiny.Uni<T> withStatelessTransaction(java.util.function.BiFunction<Mutiny.StatelessSession,Mutiny.Transaction,io.smallrye.mutiny.Uni<T>> work)
Mutiny.SessionFactory
reactive session
within an
associated transaction
.
The session will be closed automatically and the transaction committed automatically.
withStatelessTransaction
in interface Mutiny.SessionFactory
work
- a function which accepts the stateless session and returns
the result of the work as a Uni
.Mutiny.SessionFactory.withStatelessSession(Function)
,
Mutiny.StatelessSession.withTransaction(Function)
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)
Mutiny.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 Mutiny.SessionFactory
tenantId
- the id of the tenantwork
- a function which accepts the session and returns
the result of the work as a Uni
.Mutiny.SessionFactory.withSession(String, Function)
,
Mutiny.Session.withTransaction(Function)
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)
Mutiny.SessionFactory
reactive session
for a
specified tenant within an associated transaction
.
The session will be closed automatically and the transaction committed automatically.
withStatelessTransaction
in interface Mutiny.SessionFactory
tenantId
- the id of the tenantwork
- a function which accepts the stateless session and returns
the result of the work as a Uni
.Mutiny.SessionFactory.withStatelessSession(String, Function)
,
Mutiny.StatelessSession.withTransaction(Function)
public javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
getCriteriaBuilder
in interface Mutiny.SessionFactory
CriteriaBuilder
for creating
criteria queries.public javax.persistence.metamodel.Metamodel getMetamodel()
Mutiny.SessionFactory
Metamodel
for the persistence unit.getMetamodel
in interface Mutiny.SessionFactory
public org.hibernate.Cache getCache()
Mutiny.SessionFactory
Cache
object for managing the second-level
cache.getCache
in interface Mutiny.SessionFactory
public void close()
Mutiny.SessionFactory
close
in interface java.lang.AutoCloseable
close
in interface Mutiny.SessionFactory
public boolean isOpen()
isOpen
in interface Mutiny.SessionFactory
Mutiny.SessionFactory.close()
has been called