Example usage for org.springframework.orm.jpa EntityManagerFactoryInfo getPersistenceUnitInfo

List of usage examples for org.springframework.orm.jpa EntityManagerFactoryInfo getPersistenceUnitInfo

Introduction

In this page you can find the example usage for org.springframework.orm.jpa EntityManagerFactoryInfo getPersistenceUnitInfo.

Prototype

@Nullable
PersistenceUnitInfo getPersistenceUnitInfo();

Source Link

Document

Return the PersistenceUnitInfo used to create this EntityManagerFactory, if the in-container API was used.

Usage

From source file:org.springframework.orm.jpa.ExtendedEntityManagerCreator.java

/**
 * Actually create the EntityManager proxy.
 * @param rawEntityManager raw EntityManager
 * @param emfInfo the EntityManagerFactoryInfo to obtain the JpaDialect
 * and PersistenceUnitInfo from/*from w  ww  .  ja v a2  s. co  m*/
 * @param containerManaged whether to follow container-managed EntityManager
 * or application-managed EntityManager semantics
 * @param synchronizedWithTransaction whether to automatically join ongoing
 * transactions (according to the JPA 2.1 SynchronizationType rules)
 * @return the EntityManager proxy
 */
private static EntityManager createProxy(EntityManager rawEntityManager, EntityManagerFactoryInfo emfInfo,
        boolean containerManaged, boolean synchronizedWithTransaction) {

    Assert.notNull(emfInfo, "EntityManagerFactoryInfo must not be null");
    JpaDialect jpaDialect = emfInfo.getJpaDialect();
    PersistenceUnitInfo pui = emfInfo.getPersistenceUnitInfo();
    Boolean jta = (pui != null ? pui.getTransactionType() == PersistenceUnitTransactionType.JTA : null);
    return createProxy(rawEntityManager, emfInfo.getEntityManagerInterface(), emfInfo.getBeanClassLoader(),
            jpaDialect, jta, containerManaged, synchronizedWithTransaction);
}