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
According to the seam 3 persistence document,
There is maybe some issues when using REQUIRES_NEW and Seam managed persistence context together.
|Retrieving data ...|