title: Spring @Transactional with a transaction across multiple data sources
body: <p>I have to update two data sources as part of one transaction. That is -</p>
  
  <ol>
  <li>I do an update in DB1.</li>
  <li>Then, I do another update in DB2.</li>
  </ol>
  
  <p>If update in DB2 fails, I want to roll back both DB1 and DB2 to roll back. Can this be accomplished using @Transactional ?</p>
  
  <p>Here is a sample code - </p>
  
  <pre><code>@Transactional(value="db01TransactionManager")
  public void updateDb01() {
      Entity01 entity01 = repository01.findOne(1234);
      entity01.setName("Name");
      repository01.save(entity01);
  
      //Calling method to update DB02
      updateDb02();
  }
  
  @Transactional(value="db02TransactionManager")
  public void updateDb02() {
      Entity02 entity02 = repository02.findOne(1234);
      entity02.setName("Name");
      repository02.save(entity02);
  
      //Added this to force a roll back for testing
      TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  }
  </code></pre>
  
  <p>My problem is that, the setRollbackOnly() in updateDb02 rolls back only the the Db01 transaction. </p>