Save This Page
Home » Spring-Framework-090522 » org.springframework » orm » jpa » support » [javadoc | source]
org.springframework.orm.jpa.support
public class: SharedEntityManagerBean [javadoc | source]
java.lang.Object
   org.springframework.orm.jpa.EntityManagerFactoryAccessor
      org.springframework.orm.jpa.support.SharedEntityManagerBean

All Implemented Interfaces:
    FactoryBean, InitializingBean

FactoryBean that exposes a shared JPA javax.persistence.EntityManager reference for a given EntityManagerFactory. Typically used for an EntityManagerFactory created by org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean , as direct alternative to a JNDI lookup for a Java EE 5 server's EntityManager reference.

The shared EntityManager will behave just like an EntityManager fetched from an application server's JNDI environment, as defined by the JPA specification. It will delegate all calls to the current transactional EntityManager, if any; otherwise, it will fall back to a newly created EntityManager per operation.

Can be passed to DAOs that expect a shared EntityManager reference rather than an EntityManagerFactory. Note that Spring's org.springframework.orm.jpa.JpaTransactionManager always needs an EntityManagerFactory in order to create new transactional EntityManager instances.

Fields inherited from org.springframework.orm.jpa.EntityManagerFactoryAccessor:
logger
Method from org.springframework.orm.jpa.support.SharedEntityManagerBean Summary:
afterPropertiesSet,   getObject,   getObjectType,   isSingleton,   setEntityManagerInterface
Methods from org.springframework.orm.jpa.EntityManagerFactoryAccessor:
createEntityManager,   getEntityManagerFactory,   getJpaPropertyMap,   getTransactionalEntityManager,   setEntityManagerFactory,   setJpaProperties,   setJpaPropertyMap
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.orm.jpa.support.SharedEntityManagerBean Detail:
 public final  void afterPropertiesSet() 
 public EntityManager getObject() 
 public Class<EntityManager> getObjectType() 
 public boolean isSingleton() 
 public  void setEntityManagerInterface(Class<EntityManager> entityManagerInterface) 
    Specify the EntityManager interface to expose.

    Default is the EntityManager interface as defined by the EntityManagerFactoryInfo, if available. Else, the standard javax.persistence.EntityManager interface will be used.