Transaction handling in Application Module when used in JTA context

When Application Module is used inside the JTA transaction enabled  method( i.e when  AM method is exposed as web service or called inside a WebService or EJB with declarative transaction), framework takes a different execution path for the 'post-commit' activities such as entity cache clean up. In such case, framework use ServiceJTATxnHandlerImpl for handling the transaction and  the entity cache clean will happen only after finishing the transaction that is initiated by the calling  method(when the call returns from the wrapping service method), not right after the commit call on DBTransaction. If you want immediate clean up and does not need a global transaction management, then mark  the service method with no transaction as: @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) . This will make AM to use DefaultJTATxnHandlerImpl (as you see in normal scenario). 

Comments