5 Replies Latest reply on Feb 24, 2012 3:56 PM by Scott Marlow

    Auto flush does not work in container managed transaction

    Adriano Scheffer Newbie

      When i use the this SFSB

       

      @Stateful
      @TransactionAttribute(NEVER)
      public class TestAutoFlush implements Serializable {
      
                @PersistenceContext(type = EXTENDED)
                EntityManager entityManager;
      
                public void persistEntity() {
                     MyEntity e = new MyEntity();
                     e.setId(new Random().nextInt());
                     entityManager.persist(e);
                }
      
                @TransactionAttribute(REQUIRED)
                public void joinTransaction() {
                     // auto-flush expected
                }
      }
      
      

       

      If a call

       

      testAutoFlush.persistEntity();
      testAutoFlush.joinTransaction();
      
      

       

      My persistence context is not flushed.

       

       

      Is this a problem with AS 7 or am I missing some new configuration?