public class JPA
extends java.lang.Object
Constructor and Description |
---|
JPA() |
Modifier and Type | Method and Description |
---|---|
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.
|
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 namepublic 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.