title: Spring nested @Transactional method and rollback
body: <p>I have a @Service class which has a @Transactional method that calls another @Transactional method on the same class. I was testing rollback behavior for this and I found that it wasn't working properly. The code looks something like this:</p>
  
  <pre><code>@Service
  public class DefaulService implements ervice
  {
      @Transactional
      public void methodOne()
      {
          methodTwo();
  
              //question edited
              //this seems to be the problem
              this.serviceDAO.executeUpdateOperation();
  
          //test rollback
          throw new RuntimeException();
      }
  
      @Transactional
      public void methodTwo()
      {
          //DAO stuff
      }
  }
  </code></pre>
  
  <p>After running methodOne I check the database and the changes are there, even though the log shows "JDBCTransaction - rollback".</p>
  
  <p>If I call methodTwo individually and add an exception at the end of it, the changes are rolled back correctly.</p>
  
  <p>Is there a way to make methodOne properly rollback changes that occurred during the nested @Transactional call? I was under the impression that the default propagation of REQUIRED would achieve this, but it doesn't seem to be working. Thanks</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Ok, I just noticed something else. Right before the exception throw, I'm calling the service's dao and performing a manual update via 'executeUpdate'. If I comment this line, the nested rollback works. So it seems that the problem is actually calling the DAO and running executeUpdate query. But shouldn't this also run inside the current transaction?</p>