2 Replies Latest reply on Aug 15, 2012 11:22 AM by Lukas Camra

    Seam Managed Persistence Context and REQUIRES_NEW transaction attribute

    Lukas Camra Newbie

      I'm developing with JBoss 7.1.1 Final, Weld, Hibernate 4, Seam 3 and I found a problem with REQUIRES_NEW transaction attribute. I'm trying to invoke a method in EJB that is annotated by REQUIRES_NEW transaction attribute  from a @ViewScoped managed bean. Since I use Persistence module of Seam 3, the transaction is started even for the method in the managed bean but when the managed bean calls EJB's method, it doesn't create new transaction. However, If in the service (EJB) I inject entityManager using @PersistenceContext, then it works fine. So does SMPC ignore REQUIRES_NEW annotation? I don't understand this behavior.


      To clarify: I need a new transaction to be created for the method in EJB because I use COMMIT FlushMode type and therefore once the method in EJB finishes I need entitymanager to flush automatically.






      btw, I also opened Stack overflow discussion about it: http://stackoverflow.com/questions/11943680/flushmode-type-commit-used-with-requires-new-transaction-attribute