EntityManagerFactory,
usually in order to obtain a JPA EntityManager. Defines common properties.
EntityManagerFactoryUtils
| Modifier and Type | Field and Description |
|---|---|
| private EntityManagerFactory | |
| private final Map | |
| protected final Log | logger
Logger available to subclasses. |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected EntityManager | Returns: a new EntityManagerObtain a new EntityManager from this accessor's EntityManagerFactory. |
| public EntityManagerFactory | getEntityManagerFactory()
Return the JPA EntityManagerFactory that should be used to create EntityManagers. |
| public Map | getJpaPropertyMap()
Allow |
| public String | getPersistenceUnitName()
Return the name of the persistence unit to access the EntityManagerFactory for, if any. |
| protected EntityManager | Returns: the transactional EntityManager, ornull if noneObtain the transactional EntityManager for this accessor's EntityManagerFactory, if any. |
| protected final EntityManagerFactory | Returns: the EntityManagerFactory (nevernull)Obtain the EntityManagerFactory for actual use. |
| public void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. Retrieves an EntityManagerFactory by persistence unit name, if none set explicitly. |
| public void | setEntityManagerFactory(EntityManagerFactory emf)
Set the JPA EntityManagerFactory that should be used to create EntityManagers. |
| public void | setJpaProperties(Properties jpaProperties)
Specify JPA properties, to be passed into
|
| public void | setJpaPropertyMap(Map<String, Object> jpaProperties)
Specify JPA properties as a Map, to be passed into
|
| public void | setPersistenceUnitName(String persistenceUnitName)
Set the name of the persistence unit to access the EntityManagerFactory for. |
| entityManagerFactory | back to summary |
|---|---|
| private EntityManagerFactory entityManagerFactory
| |
| jpaPropertyMap | back to summary |
|---|---|
| private final Map<String, Object> jpaPropertyMap | |
| logger | back to summary |
|---|---|
| protected final Log logger Logger available to subclasses. | |
| persistenceUnitName | back to summary |
|---|---|
| private String persistenceUnitName
| |
| EntityManagerFactoryAccessor | back to summary |
|---|---|
| public EntityManagerFactoryAccessor() | |
| createEntityManager | back to summary |
|---|---|
| protected EntityManager createEntityManager() throws IllegalStateException Obtain a new EntityManager from this accessor's EntityManagerFactory. Can be overridden in subclasses to create specific EntityManager variants.
| |
| getEntityManagerFactory | back to summary |
|---|---|
| public EntityManagerFactory getEntityManagerFactory() Return the JPA EntityManagerFactory that should be used to create EntityManagers.
| |
| getJpaPropertyMap | back to summary |
|---|---|
| public Map Allow Useful for specifying entries directly, for example via | |
| getPersistenceUnitName | back to summary |
|---|---|
| public String getPersistenceUnitName() Return the name of the persistence unit to access the EntityManagerFactory for, if any.
| |
| getTransactionalEntityManager | back to summary |
|---|---|
| protected EntityManager getTransactionalEntityManager() throws IllegalStateException Obtain the transactional EntityManager for this accessor's EntityManagerFactory, if any.
| |
| obtainEntityManagerFactory | back to summary |
|---|---|
| protected final EntityManagerFactory obtainEntityManagerFactory() Obtain the EntityManagerFactory for actual use.
| |
| setBeanFactory | back to summary |
|---|---|
| public void setBeanFactory(BeanFactory beanFactory) throws BeansException Implements org. Retrieves an EntityManagerFactory by persistence unit name, if none set explicitly. Falls back to a default EntityManagerFactory bean if no persistence unit specified.
| |
| setEntityManagerFactory | back to summary |
|---|---|
| public void setEntityManagerFactory(EntityManagerFactory emf) Set the JPA EntityManagerFactory that should be used to create EntityManagers. | |
| setJpaProperties | back to summary |
|---|---|
| public void setJpaProperties(Properties jpaProperties) Specify JPA properties, to be passed into
Can be populated with a String "value" (parsed via PropertiesEditor) or a "props" element in XML bean definitions. | |
| setJpaPropertyMap | back to summary |
|---|---|
| public void setJpaPropertyMap(Map<String, Object> jpaProperties) Specify JPA properties as a Map, to be passed into
Can be populated with a "map" or "props" element in XML bean definitions. | |
| setPersistenceUnitName | back to summary |
|---|---|
| public void setPersistenceUnitName(String persistenceUnitName) Set the name of the persistence unit to access the EntityManagerFactory for. This is an alternative to specifying the EntityManagerFactory by direct reference, resolving it by its persistence unit name instead. If no EntityManagerFactory and no persistence unit name have been specified, a default EntityManagerFactory will be retrieved through finding a single unique bean of type EntityManagerFactory.
| |