use of org.springframework.orm.jpa.JpaTransactionManager in project kylo by Teradata.
the class OperationalMetadataConfig method transactionManager.
/**
* Return the entity manager
* the datasource bean is configured in the base services application
*
* @param dataSource the datasource to use as the connection for the entity manager
* @return the entity manager
*/
/*@Bean(name = "operationalMetadataJpaEntityManager")
public EntityManager entityManager(@Qualifier("dataSource") DataSource dataSource) {
return entityManagerFactory(dataSource).createEntityManager();
}*/
/**
* Return the JPA transaction manager
*
* @return the JPA transaction manager
*/
@Bean(name = "operationalMetadataTransactionManager")
public PlatformTransactionManager transactionManager(@Qualifier("dataSource") DataSource dataSource) {
JpaTransactionManager xtnMgr = new JpaTransactionManager(entityManagerFactory(dataSource));
xtnMgr.setDataSource(dataSource);
xtnMgr.setTransactionSynchronization(AbstractPlatformTransactionManager.SYNCHRONIZATION_ALWAYS);
return xtnMgr;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project spring-boot by spring-projects.
the class JpaBaseConfiguration method transactionManager.
@Bean
@ConditionalOnMissingBean(TransactionManager.class)
public PlatformTransactionManager transactionManager(ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManagerCustomizers.ifAvailable((customizers) -> customizers.customize(transactionManager));
return transactionManager;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project spring-boot by spring-projects.
the class HibernateJpaAutoConfigurationTests method jtaCustomTransactionManagerUsingProperties.
@Test
void jtaCustomTransactionManagerUsingProperties() {
contextRunner().withPropertyValues("spring.transaction.default-timeout:30", "spring.transaction.rollback-on-commit-failure:true").run((context) -> {
JpaTransactionManager transactionManager = context.getBean(JpaTransactionManager.class);
assertThat(transactionManager.getDefaultTimeout()).isEqualTo(30);
assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue();
});
}
use of org.springframework.orm.jpa.JpaTransactionManager in project flytecnologia-api by jullierme.
the class FlyHibernateConfig method transactionManager.
@Bean
@Primary
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(emf);
return transactionManager;
}
use of org.springframework.orm.jpa.JpaTransactionManager in project tutorials by eugenp.
the class MySQLAutoconfiguration method transactionManager.
@Bean
@ConditionalOnMissingBean(type = "JpaTransactionManager")
JpaTransactionManager transactionManager(final EntityManagerFactory entityManagerFactory) {
final JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory);
return transactionManager;
}
Aggregations