title: TransactionAttribute.REQUIRES_NEW not starting new transaction in EJB bean using container managed transaction
body: <pre><code>@Singelton
  public Class className {
      
      @Resource
      private TransactionSynchronizationRegistry tsr;
      
      @Resource 
      private Transaction 
      
      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      public method_A () {
      
           System.out.println(tsr.getTransactionStatus()); // prints 0 
      
           method_call_which_throw_persistence_exception(); 
      
           System.out.println(tsr.getTransactionStatus());  // prints 1
      
           method_B();
      
      }
      
      @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
      public method_B () {
            System.out.println(tsr.getTransactionStatus());  // prints 1
      }                
  } 
  </code></pre>
  <p>Note:</p>
  <ul>
  <li>Transaction status <code>0 = active</code>.</li>
  <li>Transaction status <code>1 = markedForRollback</code></li>
  </ul>
  <p>As i have attached the code above, 2 methods are present in a Ejb singelton bean which is using container managed transaction. <code>method_A</code> starts which have <code>TransactionAttribute</code> as <code>REQUIRED</code> thus  <code>TransactionSynchronizationRegistry</code> prints transaction status as <code>0</code> in starting.</p>
  <p>After a method call which throw runtime exception transaction status becomes <code>1</code> automatically. But when a <code>method_B</code> which have transaction attribute as <code>REQUIRES_NEW</code> is called still <code>TransactionSynchronizationRegistry</code> prints <code>1</code>.</p>
  <p>As per my understanding it should start a new transaction and the trasaction status should show as <code>0</code> in <code>method_B</code>?</p>