Implementation of this interface should provide at least two constructors:
Properties
- will be used if implementation is used as additional named EMF providerModifier and Type | Field and Description |
---|---|
static java.lang.String | ENTITY_MANAGER Name of sub property for resource reference to entity manager. |
static java.lang.String | ENTITY_MANAGER_FACTORY Name of sub property for resource reference to entity manager factory. |
static java.lang.String | JPA_ENTITY_MANAGER Name of property for resource reference to entity manager. |
static java.lang.String | JPA_ENTITY_MANAGER_FACTORY Name of property for resource reference to entity manager factory. |
static java.lang.String | JPA_PERSISTENCE_UNIT_NAME Name of property for persistence unit name. |
static java.lang.String | JPA_TRANSACTION Name of property for resource reference to transaction or transaction manager. |
static java.lang.String | PERSISTENCE_UNIT_NAME Name of sub property for persistence unit name. |
static java.lang.String | TRANSACTION Name of sub property for resource reference to transaction or transaction manager. |
Modifier and Type | Method and Description |
---|---|
void | commitTransaction(java.lang.Object tx) Commits specified transaction. |
EntityManagerFactory | get() Returns EntityManagerFactory . |
EntityManager | getEntityManager() Returns EntityManager for persistence operations. |
java.lang.Object | getTransaction(EntityManager em) Returns started transaction. |
void | returnEntityManager(EntityManager em) Closes EntityManager . |
void | rollbackTransaction(java.lang.Object tx) Rolls back specified transaction. |
static final java.lang.String PERSISTENCE_UNIT_NAME
static final java.lang.String JPA_PERSISTENCE_UNIT_NAME
static final java.lang.String ENTITY_MANAGER
static final java.lang.String JPA_ENTITY_MANAGER
static final java.lang.String ENTITY_MANAGER_FACTORY
static final java.lang.String JPA_ENTITY_MANAGER_FACTORY
static final java.lang.String TRANSACTION
static final java.lang.String JPA_TRANSACTION
EntityManagerFactory get()
EntityManagerFactory
.EntityManagerFactory
.EntityManager getEntityManager() throws PersistenceException
EntityManager
for persistence operations.EntityManager
for persistence operations.PersistenceException
- if unable to acquire EntityManager
.void returnEntityManager(EntityManager em)
EntityManager
.em
- EntityManager
which should be closed.java.lang.Object getTransaction(EntityManager em) throws java.lang.Exception
em
- EntityManager
needed if joining to existing transaction or starting transaction locally.Object
Already started transaction for persistence operations.java.lang.Exception
- if unable to acquire or open transaction.void commitTransaction(java.lang.Object tx) throws java.lang.Exception
tx
- Object
transaction to be commited.java.lang.Exception
- occured while committing transaction.void rollbackTransaction(java.lang.Object tx)
tx
- Object
transaction to be rolled back.