Example usage for org.springframework.orm.jpa.support OpenEntityManagerInViewFilter DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME

List of usage examples for org.springframework.orm.jpa.support OpenEntityManagerInViewFilter DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME

Introduction

In this page you can find the example usage for org.springframework.orm.jpa.support OpenEntityManagerInViewFilter DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME.

Prototype

String DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME

To view the source code for org.springframework.orm.jpa.support OpenEntityManagerInViewFilter DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME.

Click Source Link

Document

Default EntityManagerFactory bean name: "entityManagerFactory".

Usage

From source file:org.jasig.jpa.OpenEntityManagerAspect.java

/**
 * Look up the EntityManagerFactory that this filter should use.
 * <p>The default implementation looks for a bean with the specified name
 * in Spring's root application context.
 * @return the EntityManagerFactory to use
 * @see #getEntityManagerFactoryBeanName
 *///from   www.j  a v a 2 s . c om
protected EntityManagerFactory lookupEntityManagerFactory(OpenEntityManager openEntityManager) {
    String emfBeanName = openEntityManager.name();
    String puName = openEntityManager.unitName();
    if (StringUtils.hasLength(emfBeanName)) {
        return this.applicationContext.getBean(emfBeanName, EntityManagerFactory.class);
    } else if (!StringUtils.hasLength(puName) && this.applicationContext
            .containsBean(OpenEntityManagerInViewFilter.DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME)) {
        return this.applicationContext.getBean(
                OpenEntityManagerInViewFilter.DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME,
                EntityManagerFactory.class);
    } else {
        // Includes fallback search for single EntityManagerFactory bean by type.
        return EntityManagerFactoryUtils.findEntityManagerFactory(this.applicationContext, puName);
    }
}