Java 类org.springframework.orm.jpa.ExtendedEntityManagerCreator 实例源码

项目:lams    文件:PersistenceAnnotationBeanPostProcessor.java   
private EntityManager resolveExtendedEntityManager(Object target, String requestingBeanName) {
    // Obtain EntityManager reference from JNDI?
    EntityManager em = getPersistenceContext(this.unitName, true);
    if (em == null) {
        // No pre-built EntityManager found -> build one based on factory.
        // Obtain EntityManagerFactory from JNDI?
        EntityManagerFactory emf = getPersistenceUnit(this.unitName);
        if (emf == null) {
            // Need to search for EntityManagerFactory beans.
            emf = findEntityManagerFactory(this.unitName, requestingBeanName);
        }
        // Inject a container-managed extended EntityManager.
        em = ExtendedEntityManagerCreator.createContainerManagedEntityManager(
                emf, this.properties, this.synchronizedWithTransaction);
    }
    if (em instanceof EntityManagerProxy &&
            beanFactory != null && !beanFactory.isPrototype(requestingBeanName)) {
        extendedEntityManagersToClose.put(target, ((EntityManagerProxy) em).getTargetEntityManager());
    }
    return em;
}
项目:spring4-understanding    文件:PersistenceAnnotationBeanPostProcessor.java   
private EntityManager resolveExtendedEntityManager(Object target, String requestingBeanName) {
    // Obtain EntityManager reference from JNDI?
    EntityManager em = getPersistenceContext(this.unitName, true);
    if (em == null) {
        // No pre-built EntityManager found -> build one based on factory.
        // Obtain EntityManagerFactory from JNDI?
        EntityManagerFactory emf = getPersistenceUnit(this.unitName);
        if (emf == null) {
            // Need to search for EntityManagerFactory beans.
            emf = findEntityManagerFactory(this.unitName, requestingBeanName);
        }
        // Inject a container-managed extended EntityManager.
        em = ExtendedEntityManagerCreator.createContainerManagedEntityManager(
                emf, this.properties, this.synchronizedWithTransaction);
    }
    if (em instanceof EntityManagerProxy && beanFactory != null &&
            beanFactory.containsBean(requestingBeanName) && !beanFactory.isPrototype(requestingBeanName)) {
        extendedEntityManagersToClose.put(target, ((EntityManagerProxy) em).getTargetEntityManager());
    }
    return em;
}
项目:class-guard    文件:PersistenceAnnotationBeanPostProcessor.java   
private EntityManager resolveExtendedEntityManager(Object target, String requestingBeanName) {
    // Obtain EntityManager reference from JNDI?
    EntityManager em = getPersistenceContext(this.unitName, true);
    if (em == null) {
        // No pre-built EntityManager found -> build one based on factory.
        // Obtain EntityManagerFactory from JNDI?
        EntityManagerFactory emf = getPersistenceUnit(this.unitName);
        if (emf == null) {
            // Need to search for EntityManagerFactory beans.
            emf = findEntityManagerFactory(this.unitName, requestingBeanName);
        }
        // Inject a container-managed extended EntityManager.
        em = ExtendedEntityManagerCreator.createContainerManagedEntityManager(emf, this.properties);
    }
    if (em instanceof EntityManagerProxy &&
            beanFactory != null && !beanFactory.isPrototype(requestingBeanName)) {
        extendedEntityManagersToClose.put(target, ((EntityManagerProxy) em).getTargetEntityManager());
    }
    return em;
}
项目:spring4-understanding    文件:AbstractJpaTests.java   
/**
 * Create an EntityManager that will always automatically enlist itself in current
 * transactions, in contrast to an EntityManager returned by
 * {@code EntityManagerFactory.createEntityManager()}
 * (which requires an explicit {@code joinTransaction()} call).
 */
protected EntityManager createContainerManagedEntityManager() {
    return ExtendedEntityManagerCreator.createContainerManagedEntityManager(this.entityManagerFactory);
}
项目:class-guard    文件:AbstractJpaTests.java   
/**
 * Create an EntityManager that will always automatically enlist itself in current
 * transactions, in contrast to an EntityManager returned by
 * {@code EntityManagerFactory.createEntityManager()}
 * (which requires an explicit {@code joinTransaction()} call).
 */
protected EntityManager createContainerManagedEntityManager() {
    return ExtendedEntityManagerCreator.createContainerManagedEntityManager(this.entityManagerFactory);
}
项目:class-guard    文件:AbstractJpaTests.java   
/**
 * Create an EntityManager that will always automatically enlist itself in current
 * transactions, in contrast to an EntityManager returned by
 * {@code EntityManagerFactory.createEntityManager()}
 * (which requires an explicit {@code joinTransaction()} call).
 */
protected EntityManager createContainerManagedEntityManager() {
    return ExtendedEntityManagerCreator.createContainerManagedEntityManager(this.entityManagerFactory);
}