public interface JPAApi
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
|
JPAApi start()
javax.persistence.EntityManager em(java.lang.String name)
name
- The persistence unit name<T> T withTransaction(F.Function0<T> block) throws java.lang.Throwable
block
- Block of code to executejava.lang.Throwable
@Deprecated <T> F.Promise<T> withTransactionAsync(F.Function0<F.Promise<T>> block) throws java.lang.Throwable
block
- Block of code to executejava.lang.Throwable
void withTransaction(F.Callback0 block)
block
- Block of code to execute<T> T withTransaction(java.lang.String name, boolean readOnly, F.Function0<T> block) throws java.lang.Throwable
name
- The persistence unit namereadOnly
- Is the transaction read-only?block
- Block of code to executejava.lang.Throwable
@Deprecated <T> F.Promise<T> withTransactionAsync(java.lang.String name, boolean readOnly, F.Function0<F.Promise<T>> block) throws java.lang.Throwable
name
- The persistence unit namereadOnly
- Is the transaction read-only?block
- Block of code to execute.java.lang.Throwable
void shutdown()