title: Java Spring @Transactional method not rolling back as expected
body: <p>Below is a quick outline of what I'm trying to do. I want to push a record to two different tables in the database from one method call. If anything fails, I want everything to roll back. So if <code>insertIntoB</code> fails, I want anything that would be committed in <code>insertIntoA</code> to be rolled back.</p>
  
  <pre><code>public class Service {
      MyDAO dao;
  
      public void insertRecords(List&lt;Record&gt; records){
          for (Record record : records){
              insertIntoAAndB(record);
          }
      }
  
      @Transactional (rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
      public void insertIntoAAndB(Record record){
          insertIntoA(record);
          insertIntoB(record);
      }
  
      @Transactional(propagation = Propagation.REQUIRED)
      public void insertIntoA(Record record){
          dao.insertIntoA(record);
      }
  
      @Transactional(propagation = Propagation.REQUIRED)
      public void insertIntoB(Record record){
          dao.insertIntoB(record);
      }
  
      public void setMyDAO(final MyDAO dao) {
          this.dao = dao;
      }
  }
  </code></pre>
  
  <p>Where <code>MyDAO dao</code> is an interface that is mapped to the database using mybatis and is set using Spring injections. </p>
  
  <p>Right now if <code>insertIntoB</code> fails, everything from <code>insertIntoA</code> still gets pushed to the database. How can I correct this behavior?</p>
  
  <p>EDIT:</p>
  
  <p>I modified the class to give a more accurate description of what I'm trying to achieve. If I run <code>insertIntoAAndB</code> directly, the roll back works if there are any issues, but if I call <code>insertIntoAAndB</code> from <code>insertRecords</code>, the roll back doesn't work if any issues arise.</p>