Modifier and Type | Class and Description |
---|---|
static class |
DefaultJPAApi.JPAApiProvider |
Constructor and Description |
---|
DefaultJPAApi(JPAConfig jpaConfig) |
DefaultJPAApi(JPAConfig jpaConfig,
JPAEntityManagerContext entityManagerContext)
Deprecated.
Deprecated as of 2.7.0. Use
DefaultJPAApi(JPAConfig) instead. |
Modifier and Type | Method and Description |
---|---|
javax.persistence.EntityManager |
em()
Deprecated.
Deprecated as of 2.7.0. The EntityManager is supplied as lambda parameter instead when using
withTransaction(Function) |
javax.persistence.EntityManager |
em(java.lang.String name)
Get a newly created EntityManager for the specified persistence unit name.
|
void |
shutdown()
Close all entity manager factories.
|
JPAApi |
start()
Initialise JPA entity manager factories.
|
void |
withTransaction(java.util.function.Consumer<javax.persistence.EntityManager> block)
Run a block of code with a newly created EntityManager for the default Persistence Unit.
|
<T> T |
withTransaction(java.util.function.Function<javax.persistence.EntityManager,T> block)
Run a block of code with a newly created EntityManager for the default Persistence Unit.
|
void |
withTransaction(java.lang.Runnable block)
Deprecated.
Deprecated as of 2.7.0. Use
withTransaction(Consumer) instead. |
void |
withTransaction(java.lang.String name,
boolean readOnly,
java.util.function.Consumer<javax.persistence.EntityManager> block)
Run a block of code with a newly created EntityManager for the named Persistence Unit.
|
<T> T |
withTransaction(java.lang.String name,
boolean readOnly,
java.util.function.Function<javax.persistence.EntityManager,T> block)
Run a block of code with a newly created EntityManager for the named Persistence Unit.
|
<T> T |
withTransaction(java.lang.String name,
boolean readOnly,
java.util.function.Supplier<T> block)
Deprecated.
Deprecated as of 2.7.0. Use
withTransaction(String, boolean, Function) instead. |
void |
withTransaction(java.lang.String name,
java.util.function.Consumer<javax.persistence.EntityManager> block)
Run a block of code with a newly created EntityManager for the named Persistence Unit.
|
<T> T |
withTransaction(java.lang.String name,
java.util.function.Function<javax.persistence.EntityManager,T> block)
Run a block of code with a newly created EntityManager for the named Persistence Unit.
|
<T> T |
withTransaction(java.util.function.Supplier<T> block)
Deprecated.
Deprecated as of 2.7.0. Use
withTransaction(Function) instead. |
@Deprecated public DefaultJPAApi(JPAConfig jpaConfig, JPAEntityManagerContext entityManagerContext)
DefaultJPAApi(JPAConfig)
instead.public DefaultJPAApi(JPAConfig jpaConfig)
public JPAApi start()
public javax.persistence.EntityManager em(java.lang.String name)
@Deprecated public javax.persistence.EntityManager em()
withTransaction(Function)
public <T> T withTransaction(java.util.function.Function<javax.persistence.EntityManager,T> block)
withTransaction
in interface JPAApi
T
- type of resultblock
- Block of code to executepublic void withTransaction(java.util.function.Consumer<javax.persistence.EntityManager> block)
withTransaction
in interface JPAApi
block
- Block of code to executepublic <T> T withTransaction(java.lang.String name, java.util.function.Function<javax.persistence.EntityManager,T> block)
withTransaction
in interface JPAApi
T
- type of resultname
- The persistence unit nameblock
- Block of code to executepublic void withTransaction(java.lang.String name, java.util.function.Consumer<javax.persistence.EntityManager> block)
withTransaction
in interface JPAApi
name
- The persistence unit nameblock
- Block of code to executepublic <T> T withTransaction(java.lang.String name, boolean readOnly, java.util.function.Function<javax.persistence.EntityManager,T> block)
withTransaction
in interface JPAApi
T
- type of resultname
- The persistence unit namereadOnly
- Is the transaction read-only?block
- Block of code to executepublic void withTransaction(java.lang.String name, boolean readOnly, java.util.function.Consumer<javax.persistence.EntityManager> block)
withTransaction
in interface JPAApi
name
- The persistence unit namereadOnly
- Is the transaction read-only?block
- Block of code to execute@Deprecated public <T> T withTransaction(java.util.function.Supplier<T> block)
withTransaction(Function)
instead.withTransaction
in interface JPAApi
T
- type of resultblock
- Block of code to execute@Deprecated public void withTransaction(java.lang.Runnable block)
withTransaction(Consumer)
instead.withTransaction
in interface JPAApi
block
- Block of code to execute@Deprecated public <T> T withTransaction(java.lang.String name, boolean readOnly, java.util.function.Supplier<T> block)
withTransaction(String, boolean, Function)
instead.withTransaction
in interface JPAApi
T
- type of resultname
- The persistence unit namereadOnly
- Is the transaction read-only?block
- Block of code to execute