AnsweredAssumed Answered

Transactions - autocommit - atomicity

Question asked by neville.sequeira on Sep 10, 2013
Latest reply on Sep 12, 2013 by neville.sequeira
Creating this new topic as a follow up to the topic - http://forums.activiti.org/content/any-way-get-reference-created-task-task-create-listener

I have following two major actions in my test case which executes a simple process that has only one user task between start and end nodes.
1. Start a process.
2. Using TaskService execute a TaskQuery to get the user task.
3. Do some application specific thing not related to Activiti.

I get
null
as result from TaskQuery. And that seems to be because the Activiti data created by starting the process has not been committed to the database (as stated in the referenced topic). I have set autocommit to true on my datasource configuration. I cannot set it to true because I need to make sure all the three logical steps in my application, as mentioned above, are running in one transaction. Either everything should be committed or nothing should be committed.

How are folks resolving such atomicity need in using Activiti? Is there some setting either for Activiti or for iBatis/MyBatis which will/can make this work. Or is there a specific ProcessEngine configuration to use for such scenarios?

I know the out-of-box test cases that come with Activiti run sucessfully. But I am assuming that's probably only because by default the datasource setting for autocommit on database connections is true.

I have tried various different transaction managers and various different Activiti ProcessConfigurations.

Any and all pointers will be highly appreciated.

Outcomes