title: Spring @Transactional and PROPAGATION_REQUIRES_NEW with sql server 2012
body: <p>I have a service that has several methods marked with <code>@Transactional</code>, including methods a, b and c. These 3 methods are nested in the following way a -> b -> c. Here is a code sample:</p>
  
  <pre><code>@Transactional
  public void a() {
      while(condition) {
          try {
              b();
          } catch(MyException e) {
              logger.warn(e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>Method b however is annotated like this:</p>
  
  <pre><code>@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = {MyException.class})
  </code></pre>
  
  <p>However, when <code>MyException</code> is thrown from method c, the exception is caught at method a and when that exits, the transaction is comitted and that includes whatever has been done by call to b() that threw the exception and should have been rolled back(?). 
  I am using sql server 2012 express with spring 3.0.7 and my spring configuration is like this:</p>
  
  <pre><code>&lt;tx:annotation-driven /&gt;
  &lt;bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager"&gt;
      &lt;qualifier value="txm1"/&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt;
  &lt;/bean&gt;
  &lt;bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
      &lt;property name="persistenceXmlLocation" value="classpath:META-INF/jpa-persistence.xml"/&gt;
      &lt;property name="persistenceUnitName" value="Unit1" /&gt;
  &lt;/bean&gt;
  </code></pre>