AnsweredAssumed Answered

JtaTransactionContext and transaction management

Question asked by mebold on Sep 19, 2012
Latest reply on Sep 20, 2012 by mebold
Hi all,

I've used Activiti5.9 till now and I've decided to upgrade to the 5.10 release. In my project I'm using an embedded Activiti ProcessEngine running in osgi environment. To communicate with the database (h2, MySql, MSSQL depending on our configuration) I'm using the transactionmanager provided by the osgi container (ServiceMix 1.2.0). Using the 5.9 version everything worked properly.

When I've changed to the 5.10 version suddenly nothing was inserted into the database. No exceptions, even the transactionManager.commit() function was called while I was debugging it. However, it seemed that no transactions were properly ended, at least nothing was inserted into the database.

After browsing through the release notes I've found this JIRA issue:
http://jira.codehaus.org/browse/ACT-1188

Comparing the changes to the previous version I've seen that the StandaloneMybatisTransactionContextFactory was replaced by the new JtaTransactionContextFactory, reverting this solved the issue. After this I've found that there is a property of the JtaProcessEngineConfiguration: setTransactionExternallyManaged(bool). Since the default value is false I've chaged it to true and having this flag set the to true the new code with the JtaTransactionContextFactory works again.

Though the problem is solved could anyone give me an explanation why and how exactly this should work? How come the commit is called, no exceptions are thrown (eg. SecurityException indicating that commit is not allowed here) if the transactionExternallyManaged is set to false in the activiti configuration?

Thanks, Orsi

Outcomes