Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.DataSourceTransactionManager


                @Override
                public Object doInConnection(Connection con) throws SQLException, DataAccessException {
                    //This is horribly hacky but we can't rely on the main uPortal TM directly or we get
                    //into a circular dependency loop from JPA to Ehcache to jGroups and back to JPA
                    final DataSource ds = new SingleConnectionDataSource(con, true);
                    final PlatformTransactionManager ptm = new DataSourceTransactionManager(ds);
                    final TransactionOperations to = new TransactionTemplate(ptm);
                   
                    to.execute(new TransactionCallbackWithoutResult() {
                        @Override
                        protected void doInTransactionWithoutResult(TransactionStatus status) {
View Full Code Here


    return dataSource;
  }

  @Bean
  public PlatformTransactionManager transactionManager() {
    return new DataSourceTransactionManager(dataSource());
  }
View Full Code Here

  @Override
  public void afterPropertiesSet() throws Exception {
    Assert.notNull(dataSources, "data source can not be null.");
   
    for (DataSource dataSource : dataSources) {
      DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
      transactionManagers.put(dataSource, txManager);
    }
    this.addShutdownHook();
  }
View Full Code Here

      try {
        commitCount.addAndGet(1);

        log.debug("Committing JDBC transaction");
       
        DataSourceTransactionManager txManager = this.transactionManagers.get(dataSource);
       
        TransactionStatus transactionStatus = ((MultiDataSourcesTransactionStatus)status).get(dataSource);
        txManager.commit(transactionStatus);

        log.debug("Commit JDBC transaction success");
      } catch (Throwable e) {
        log.debug("Could not commit JDBC transaction", e);
        ex = e;
View Full Code Here

      try {
        log.debug("Rolling back JDBC transaction");
       
        rollbackCount.addAndGet(1);
       
        DataSourceTransactionManager txManager = this.transactionManagers.get(dataSource);
        TransactionStatus currentStatus = ((MultiDataSourcesTransactionStatus)status).get(dataSource);

        txManager.rollback(currentStatus);

        log.info("Roll back JDBC transaction success");
      } catch (Throwable e) {
        log.info("Could not roll back JDBC transaction", e);
        ex = e;
View Full Code Here

@Configuration
public class PopulatedSchemaDatabaseConfig {

  @Bean
  public PlatformTransactionManager transactionManager() {
    return new DataSourceTransactionManager(dataSource());
  }
View Full Code Here

  @Configuration
  static class Config {

    @Bean
    public PlatformTransactionManager txMgr1() {
      return new DataSourceTransactionManager(dataSource1());
    }
View Full Code Here

      return new DataSourceTransactionManager(dataSource1());
    }

    @Bean
    public PlatformTransactionManager txMgr2() {
      return new DataSourceTransactionManager(dataSource2());
    }
View Full Code Here

  @Configuration
  static class Config {

    @Bean
    public PlatformTransactionManager txMgr1() {
      return new DataSourceTransactionManager(dataSource1());
    }
View Full Code Here

      return new DataSourceTransactionManager(dataSource1());
    }

    @Bean
    public PlatformTransactionManager txMgr2() {
      return new DataSourceTransactionManager(dataSource2());
    }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.datasource.DataSourceTransactionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.