5 Replies Latest reply on Feb 27, 2012 7:59 PM by Adriano Scheffer

    EntityManager did not get enlisted in DefaultSeamTransaction

    Adriano Scheffer Newbie

      Last week I found an issue in the AS 7 (https://community.jboss.org/message/718770).

      It's about not flushing the persistence context when joining a transaction.

       

      Now, testing Seam 3 (specifically Seam Persistence), I believe I have found the same problem.

       

      Take a look in this example:

       

      @ConversationScoped
      public class PersonManager implements Serializable {
      
      
                @Inject EntityManager entityManager;
      
      
                public void createPersonAndPutInPersistenceContext() {
                          Person p = new Person();
                          p.setId(new Random().nextInt());
                          p.setName("Adriano");
                          entityManager.persist(p);
                }
      
      
        
                @Transactional
                public void joinTransaction() {
                          // auto-flush expected
                          // but EntityManager did not get enlisted in DefaultSeamTransaction
                }
      
      
      }
      
      

       

      Calling createPersonAndPutInPersistenceContext() followed by joinTransaction() did not flush my PC.

      (I am using a JTA data source)

       

      Shouldn’t Seam do the same and flush my changes to database when entering a transaction?