title: TransactionAttribute.REQUIRES_NEW in JPA
body: <p>I tested my ejb jpa transactions. I use Container-managed entityManager:</p>
  
  <pre><code>@PersistenceContext(unitName = "ParticularUnit")
  EntityManager em;
  </code></pre>
  
  <p>Such I has got transaction PersistanceContext scope and container manages each transaction.
  For each instance of pooled session beans, created instance of entityManager.
  When I mark bean method with @TransactionAttribute(TransactionAttributeType.REQUIRED) and
  invoke two method within, I expected then method test1 will have another PersitenceContext, but I was surprised, because it was the same.</p>
  
  <pre><code>@TransactionAttribute(TransactionAttributeType.REQUIRED)
  
  public void test(Configuration config){
          if (!em.contains(config)) {
              config = em.find(Configuration.class, config.getId());
          }
          System.out.println("********************");
          System.out.println("actiovation, em= "+ em);
          System.out.println("actiovation, config= "+ config);
          System.out.println("*********************");
  
          test1(config);
          test2(config);
      }
  
      @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
      public void test1(Configuration config){
          config = em.find(Configuration.class, config.getId());
          System.out.println("////////");
          System.out.println("requires_new"+ config);
          System.out.println("requires_new, em= "+ em);
          System.out.println("----------------");
      }
  
      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      public void test2(Configuration config){
          config = em.find(Configuration.class, config.getId());
          System.out.println("////////");
          System.out.println("required"+ config);
          System.out.println("required, em= "+ em);
          System.out.println("----------------");
      }
  </code></pre>
  
  <p>I call <code>test</code> and got this trace.</p>
  
  <pre><code>********************
   actiovation, em= JPATxEntityManager@54515451
   actiovation, config= com.profix.sc.db.configuration.Configuration@7f287f28
   *********************
   ////////
   requires_newcom.profix.sc.db.configuration.Configuration@7f287f28
   requires_new, em= JPATxEntityManager@54515451[PuId=SCApplication#SCApplication-ejb.jar#SCApplication, SCApplication#SCApplication-ejb.jar#PaymentConfigBean#com.profix.sc.ejb.PaymentConfigBean/em]
  ----------------
    ////////
      requiredcom.profix.sc.db.configuration.Configuration@7f287f28
    required, em= JPATxEntityManager@54515451[PuId=SCApplication#SCApplication-ejb.jar#SCApplication, SCApplication#SCApplication-ejb.jar#PaymentConfigBean#com.profix.sc.ejb.PaymentConfigBean/em]
  </code></pre>
  
  <hr>
  
  <p>Why within <code>test1()</code> persistenceContext is the same as in <code>test()</code>?</p>