|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.orm.jpa.EntityManagerFactoryAccessor
public abstract class EntityManagerFactoryAccessor
Base class for any class that needs to access an EntityManagerFactory, usually in order to obtain an EntityManager. Defines common properties.
Not intended to be used directly. See JpaAccessor
.
JpaAccessor
,
EntityManagerFactoryUtils
Field Summary | |
---|---|
private EntityManagerFactory |
entityManagerFactory
|
private java.util.Map<java.lang.String,java.lang.Object> |
jpaPropertyMap
|
protected Log |
logger
Logger available to subclasses |
Constructor Summary | |
---|---|
EntityManagerFactoryAccessor()
|
Method Summary | |
---|---|
protected EntityManager |
createEntityManager()
Obtain a new EntityManager from this accessor's EntityManagerFactory. |
EntityManagerFactory |
getEntityManagerFactory()
Return the JPA EntityManagerFactory that should be used to create EntityManagers. |
java.util.Map<java.lang.String,java.lang.Object> |
getJpaPropertyMap()
Allow Map access to the JPA properties to be passed to the persistence provider, with the option to add or override specific entries. |
protected EntityManager |
getTransactionalEntityManager()
Obtain the transactional EntityManager for this accessor's EntityManagerFactory, if any. |
void |
setEntityManagerFactory(EntityManagerFactory emf)
Set the JPA EntityManagerFactory that should be used to create EntityManagers. |
void |
setJpaProperties(java.util.Properties jpaProperties)
Specify JPA properties, to be passed into EntityManagerFactory.createEntityManager(Map) (if any). |
void |
setJpaPropertyMap(java.util.Map<java.lang.String,java.lang.Object> jpaProperties)
Specify JPA properties as a Map, to be passed into EntityManagerFactory.createEntityManager(Map) (if any). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Log logger
private EntityManagerFactory entityManagerFactory
private final java.util.Map<java.lang.String,java.lang.Object> jpaPropertyMap
Constructor Detail |
---|
public EntityManagerFactoryAccessor()
Method Detail |
---|
public void setEntityManagerFactory(EntityManagerFactory emf)
javax.persistence.EntityManagerFactory#createEntityManager()
,
javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
public EntityManagerFactory getEntityManagerFactory()
public void setJpaProperties(java.util.Properties jpaProperties)
EntityManagerFactory.createEntityManager(Map)
(if any).
Can be populated with a String "value" (parsed via PropertiesEditor) or a "props" element in XML bean definitions.
javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
public void setJpaPropertyMap(java.util.Map<java.lang.String,java.lang.Object> jpaProperties)
EntityManagerFactory.createEntityManager(Map)
(if any).
Can be populated with a "map" or "props" element in XML bean definitions.
javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
public java.util.Map<java.lang.String,java.lang.Object> getJpaPropertyMap()
Useful for specifying entries directly, for example via "jpaPropertyMap[myKey]".
protected EntityManager createEntityManager() throws java.lang.IllegalStateException
Can be overridden in subclasses to create specific EntityManager variants.
java.lang.IllegalStateException
- if this accessor is not configured with an EntityManagerFactoryjavax.persistence.EntityManagerFactory#createEntityManager()
,
javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
protected EntityManager getTransactionalEntityManager() throws java.lang.IllegalStateException
null
if none
java.lang.IllegalStateException
- if this accessor is not configured with an EntityManagerFactoryEntityManagerFactoryUtils#getTransactionalEntityManager(javax.persistence.EntityManagerFactory)
,
EntityManagerFactoryUtils#getTransactionalEntityManager(javax.persistence.EntityManagerFactory, java.util.Map)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |