Java Code Examples for org.springframework.jdbc.datasource.DataSourceTransactionManager#getDataSource()

The following examples show how to use org.springframework.jdbc.datasource.DataSourceTransactionManager#getDataSource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringJdbcTransactionOperations.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Default constructor.
 * @param transactionManager The transaction manager
 */
protected SpringJdbcTransactionOperations(
        DataSourceTransactionManager transactionManager) {
    this.dataSource = transactionManager.getDataSource();
    this.transactionManager = transactionManager;
    this.writeTransactionTemplate = new TransactionTemplate(transactionManager);
    DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition();
    transactionDefinition.setReadOnly(true);
    this.readTransactionTemplate = new TransactionTemplate(transactionManager, transactionDefinition);
}
 
Example 2
Source File: SpringJdbcUtils.java    From bdf3 with Apache License 2.0 5 votes vote down vote up
public static JdbcTemplate getJdbcTemplate(TransactionTemplate txTemplate) {  
    DataSourceTransactionManager txManager = (DataSourceTransactionManager) txTemplate  
            .getTransactionManager();  
    DataSource dataSource = txManager.getDataSource();  
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);  
    return jdbcTemplate;  
}
 
Example 3
Source File: AbstractTransactionalAnnotatedConfigClassTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Autowired
public void setTransactionManager(DataSourceTransactionManager transactionManager) {
	this.dataSourceFromTxManager = transactionManager.getDataSource();
}
 
Example 4
Source File: AbstractTransactionalAnnotatedConfigClassTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Autowired
public void setTransactionManager(DataSourceTransactionManager transactionManager) {
	this.dataSourceFromTxManager = transactionManager.getDataSource();
}
 
Example 5
Source File: TransactionalJdbcIdempotentChecker.java    From qmq with Apache License 2.0 4 votes vote down vote up
public TransactionalJdbcIdempotentChecker(DataSourceTransactionManager transactionManager, String tableName, KeyExtractor extractor) {
    super(extractor);
    this.transactionManager = transactionManager;
    this.idempotentChecker = new JdbcIdempotentChecker(transactionManager.getDataSource(), tableName, extractor);
}
 
Example 6
Source File: AbstractTransactionalAnnotatedConfigClassTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Autowired
public void setTransactionManager(DataSourceTransactionManager transactionManager) {
	this.dataSourceFromTxManager = transactionManager.getDataSource();
}