| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultJPAApi.JPAApiProvider |
| Constructor and Description |
|---|
DefaultJPAApi(JPAConfig jpaConfig) |
| Modifier and Type | Method and Description |
|---|---|
javax.persistence.EntityManager |
em(java.lang.String name)
Get the EntityManager for the specified persistence unit name.
|
void |
shutdown()
Close all entity manager factories.
|
JPAApi |
start()
Initialise JPA entity manager factories.
|
void |
withTransaction(F.Callback0 block)
Run a block of code in a JPA transaction.
|
<T> T |
withTransaction(F.Function0<T> block)
Run a block of code in a JPA transaction.
|
<T> T |
withTransaction(java.lang.String name,
boolean readOnly,
F.Function0<T> block)
Run a block of code in a JPA transaction.
|
<T> F.Promise<T> |
withTransactionAsync(F.Function0<F.Promise<T>> block)
Deprecated.
This may cause deadlocks
|
<T> F.Promise<T> |
withTransactionAsync(java.lang.String name,
boolean readOnly,
F.Function0<F.Promise<T>> block)
Deprecated.
This may cause deadlocks
|
public DefaultJPAApi(JPAConfig jpaConfig)
public JPAApi start()
public javax.persistence.EntityManager em(java.lang.String name)
public <T> T withTransaction(F.Function0<T> block) throws java.lang.Throwable
withTransaction in interface JPAApiblock - Block of code to executejava.lang.Throwable@Deprecated public <T> F.Promise<T> withTransactionAsync(F.Function0<F.Promise<T>> block) throws java.lang.Throwable
withTransactionAsync in interface JPAApiblock - Block of code to executejava.lang.Throwablepublic void withTransaction(F.Callback0 block)
withTransaction in interface JPAApiblock - Block of code to executepublic <T> T withTransaction(java.lang.String name,
boolean readOnly,
F.Function0<T> block)
throws java.lang.Throwable
withTransaction in interface JPAApiname - The persistence unit namereadOnly - Is the transaction read-only?block - Block of code to executejava.lang.Throwable@Deprecated public <T> F.Promise<T> withTransactionAsync(java.lang.String name, boolean readOnly, F.Function0<F.Promise<T>> block) throws java.lang.Throwable
withTransactionAsync in interface JPAApiname - The persistence unit namereadOnly - Is the transaction read-only?block - Block of code to execute.java.lang.Throwable