public class JPA
extends java.lang.Object
Constructor and Description |
---|
JPA() |
Modifier and Type | Method and Description |
---|---|
static void |
bindForAsync(javax.persistence.EntityManager em)
Deprecated.
Use JPAEntityManagerContext.push or JPAEntityManagerContext.pop
|
static void |
bindForSync(javax.persistence.EntityManager em)
Bind an EntityManager to the current HTTP context.
|
static JPAApi |
createFor(java.lang.String unitName)
Create a default JPAApi with name "default" and the given unit name.
|
static JPAApi |
createFor(java.lang.String name,
java.lang.String unitName)
Create a default JPAApi with the given persistence unit configuration.
|
static javax.persistence.EntityManager |
em()
Get the default EntityManager for this thread.
|
static javax.persistence.EntityManager |
em(java.lang.String key)
Deprecated.
|
static JPAApi |
jpaApi()
Deprecated.
as of 2.5.0. Inject a JPAApi instead.
|
static void |
withTransaction(java.lang.Runnable block)
Deprecated.
as of 2.5.0. Inject a JPAApi instead.
|
static <T> T |
withTransaction(java.lang.String name,
boolean readOnly,
java.util.function.Supplier<T> block)
Deprecated.
as of 2.5.0. Inject a JPAApi instead.
|
static <T> T |
withTransaction(java.util.function.Supplier<T> block)
Deprecated.
as of 2.5.0. Inject a JPAApi instead.
|
public static JPAApi createFor(java.lang.String name, java.lang.String unitName)
name
- the EntityManagerFactory's nameunitName
- the persistence unit's namepublic static JPAApi createFor(java.lang.String unitName)
unitName
- the persistence unit's name@Deprecated public static JPAApi jpaApi()
@Deprecated public static javax.persistence.EntityManager em(java.lang.String key)
key
- name of the EntityManager to returnpublic static javax.persistence.EntityManager em()
java.lang.RuntimeException
- if no EntityManager is bound to the current Http.Context or the current Thread.public static void bindForSync(javax.persistence.EntityManager em)
em
- the EntityManager to bind to this HTTP context.@Deprecated public static void bindForAsync(javax.persistence.EntityManager em)
em
- the EntityManager to bindjava.lang.RuntimeException
- if no HTTP context is present.@Deprecated public static <T> T withTransaction(java.util.function.Supplier<T> block)
T
- return type of the blockblock
- Block of code to execute.@Deprecated public static void withTransaction(java.lang.Runnable block)
block
- Block of code to execute.@Deprecated public static <T> T withTransaction(java.lang.String name, boolean readOnly, java.util.function.Supplier<T> block)
T
- return type of the provided blockname
- The persistence unit namereadOnly
- Is the transaction read-only?block
- Block of code to execute.