use of org.springframework.orm.jpa.EntityManagerFactoryInfo in project spring-framework by spring-projects.
the class EclipseLinkEntityManagerFactoryIntegrationTests method testCanCastNativeEntityManagerFactoryToEclipseLinkEntityManagerFactoryImpl.
@Test
public void testCanCastNativeEntityManagerFactoryToEclipseLinkEntityManagerFactoryImpl() {
EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory;
assertTrue(emfi.getNativeEntityManagerFactory().getClass().getName().endsWith("EntityManagerFactoryImpl"));
}
use of org.springframework.orm.jpa.EntityManagerFactoryInfo in project spring-framework by spring-projects.
the class HibernateEntityManagerFactoryIntegrationTests method testCanCastNativeEntityManagerFactoryToHibernateEntityManagerFactoryImpl.
@Test
public void testCanCastNativeEntityManagerFactoryToHibernateEntityManagerFactoryImpl() {
EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory;
assertTrue(emfi.getNativeEntityManagerFactory() instanceof org.hibernate.jpa.HibernateEntityManagerFactory);
// as of Hibernate 5.2
assertTrue(emfi.getNativeEntityManagerFactory() instanceof SessionFactory);
}
use of org.springframework.orm.jpa.EntityManagerFactoryInfo in project spring-framework by spring-projects.
the class SharedEntityManagerBean method afterPropertiesSet.
@Override
public final void afterPropertiesSet() {
EntityManagerFactory emf = getEntityManagerFactory();
if (emf == null) {
throw new IllegalArgumentException("'entityManagerFactory' or 'persistenceUnitName' is required");
}
if (emf instanceof EntityManagerFactoryInfo) {
EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf;
if (this.entityManagerInterface == null) {
this.entityManagerInterface = emfInfo.getEntityManagerInterface();
if (this.entityManagerInterface == null) {
this.entityManagerInterface = EntityManager.class;
}
}
} else {
if (this.entityManagerInterface == null) {
this.entityManagerInterface = EntityManager.class;
}
}
this.shared = SharedEntityManagerCreator.createSharedEntityManager(emf, getJpaPropertyMap(), this.synchronizedWithTransaction, this.entityManagerInterface);
}
Aggregations