use of org.springframework.orm.jpa.JpaDialect in project invesdwin-context-persistence by subes.
the class PersistenceUnitContext method createTransactionManager.
private PlatformTransactionManager createTransactionManager() {
final JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
jpaTransactionManager.setEntityManagerFactory(getEntityManagerFactory());
final JpaDialect jpaDialect = getJpaDialect();
if (jpaDialect != null) {
jpaTransactionManager.setJpaDialect(jpaDialect);
}
final LoggingDelegateTransactionManager loggingDelegateTransactionManager = new LoggingDelegateTransactionManager(this, jpaTransactionManager);
final String transactionManagerBeanName = getPersistenceUnitName() + PersistenceProperties.TRANSACTION_MANAGER_NAME_SUFFIX;
MergedContext.getInstance().registerBean(transactionManagerBeanName, loggingDelegateTransactionManager);
Assertions.assertThat(MergedContext.getInstance().getBean(transactionManagerBeanName)).isNotNull();
return loggingDelegateTransactionManager;
}
use of org.springframework.orm.jpa.JpaDialect in project invesdwin-context-persistence by subes.
the class PersistenceUnitContext method createEntityManagerFactory.
private EntityManagerFactory createEntityManagerFactory() {
Assertions.assertThat(persistenceUnitContextManager.isValidPersistenceUnit(persistenceUnitName)).as("Not a valid persistence unit: %s", persistenceUnitName).isTrue();
final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setPersistenceUnitManager(persistenceUnitManager);
factory.setPersistenceUnitName(persistenceUnitName);
final JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter();
if (jpaVendorAdapter != null) {
factory.setJpaVendorAdapter(jpaVendorAdapter);
} else {
factory.setPersistenceProvider(getPersistenceProvider());
}
final JpaDialect jpaDialect = getJpaDialect();
if (jpaDialect != null) {
factory.setJpaDialect(jpaDialect);
}
factory.afterPropertiesSet();
final String entityManagerFactoryBeanName = getPersistenceUnitName() + PersistenceProperties.ENTITY_MANAGER_FACTORY_NAME_SUFFIX;
MergedContext.getInstance().registerBean(entityManagerFactoryBeanName, factory);
Assertions.assertThat(MergedContext.getInstance().getBean(entityManagerFactoryBeanName)).isNotNull();
return factory.getObject();
}
Aggregations