Search in sources :

Example 1 with DataSourceTransactionManager

use of org.springframework.jdbc.datasource.DataSourceTransactionManager in project spring-boot by spring-projects.

the class DataSourceTransactionManagerAutoConfigurationTests method testCustomizeDataSourceTransactionManagerUsingProperties.

@Test
public void testCustomizeDataSourceTransactionManagerUsingProperties() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.context, "spring.transaction.default-timeout:30", "spring.transaction.rollback-on-commit-failure:true");
    this.context.register(EmbeddedDataSourceConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, TransactionAutoConfiguration.class);
    this.context.refresh();
    DataSourceTransactionManager transactionManager = this.context.getBean(DataSourceTransactionManager.class);
    assertThat(transactionManager.getDefaultTimeout()).isEqualTo(30);
    assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue();
}
Also used : DataSourceTransactionManager(org.springframework.jdbc.datasource.DataSourceTransactionManager) Test(org.junit.Test)

Example 2 with DataSourceTransactionManager

use of org.springframework.jdbc.datasource.DataSourceTransactionManager in project camel by apache.

the class SqlTransactedRouteTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry reg = super.createRegistry();
    db = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.DERBY).build();
    reg.bind("testdb", db);
    DataSourceTransactionManager txMgr = new DataSourceTransactionManager();
    txMgr.setDataSource(db);
    reg.bind("txManager", txMgr);
    SpringTransactionPolicy txPolicy = new SpringTransactionPolicy();
    txPolicy.setTransactionManager(txMgr);
    txPolicy.setPropagationBehaviorName("PROPAGATION_REQUIRED");
    reg.bind("required", txPolicy);
    return reg;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) SpringTransactionPolicy(org.apache.camel.spring.spi.SpringTransactionPolicy) EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) DataSourceTransactionManager(org.springframework.jdbc.datasource.DataSourceTransactionManager)

Example 3 with DataSourceTransactionManager

use of org.springframework.jdbc.datasource.DataSourceTransactionManager in project Activiti by Activiti.

the class ActivitiEngineConfiguration method annotationDrivenTransactionManager.

@Bean(name = "transactionManager")
public PlatformTransactionManager annotationDrivenTransactionManager() {
    DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
    transactionManager.setDataSource(dataSource());
    return transactionManager;
}
Also used : DataSourceTransactionManager(org.springframework.jdbc.datasource.DataSourceTransactionManager) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with DataSourceTransactionManager

use of org.springframework.jdbc.datasource.DataSourceTransactionManager in project Activiti by Activiti.

the class ActivitiEngineConfiguration method annotationDrivenTransactionManager.

@Bean(name = "transactionManager")
public PlatformTransactionManager annotationDrivenTransactionManager() {
    DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
    transactionManager.setDataSource(dataSource());
    return transactionManager;
}
Also used : DataSourceTransactionManager(org.springframework.jdbc.datasource.DataSourceTransactionManager) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with DataSourceTransactionManager

use of org.springframework.jdbc.datasource.DataSourceTransactionManager in project Activiti by Activiti.

the class ActivitiEngineConfiguration method annotationDrivenTransactionManager.

@Bean(name = "transactionManager")
public PlatformTransactionManager annotationDrivenTransactionManager() {
    DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
    transactionManager.setDataSource(dataSource());
    return transactionManager;
}
Also used : DataSourceTransactionManager(org.springframework.jdbc.datasource.DataSourceTransactionManager) ProcessEngineFactoryBean(org.activiti.spring.ProcessEngineFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

DataSourceTransactionManager (org.springframework.jdbc.datasource.DataSourceTransactionManager)11 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)4 ProcessEngineFactoryBean (org.activiti.spring.ProcessEngineFactoryBean)3 Bean (org.springframework.context.annotation.Bean)3 SQLException (java.sql.SQLException)2 Test (org.junit.Test)2 TransactionStatus (org.springframework.transaction.TransactionStatus)2 GargoyleException (com.kyj.fx.voeditor.visual.exceptions.GargoyleException)1 NotSupportException (com.kyj.fx.voeditor.visual.exceptions.NotSupportException)1 File (java.io.File)1 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 ArrayList (java.util.ArrayList)1 DataSource (javax.sql.DataSource)1 JndiRegistry (org.apache.camel.impl.JndiRegistry)1 SpringTransactionPolicy (org.apache.camel.spring.spi.SpringTransactionPolicy)1 ConstraintViolationException (org.hibernate.exception.ConstraintViolationException)1 Before (org.junit.Before)1 DefaultEventConfDao (org.opennms.netmgt.config.DefaultEventConfDao)1 SnmpPeerFactory (org.opennms.netmgt.config.SnmpPeerFactory)1