TaskService batch operations using one Transaction


I’ve been trying to execute a functionality that allows a batch operation over a set of tasks (e.g. claiming, unclaiming, complete, etc), but I would like it to be done using the same transaction so all changes could be rolled back when an exception occurs.

I have tried using @Transactional spring annotation on a method that iterate over a set of Tasks, but I noticed that changes are committed to the database on each TaskService call.

I couldn’t find any particular information about that particular scenario at the official documentation.
Does Flowable Engine provide any additional configuration or functionality that would allow me to achieve this?

Any comment or help would be deeply appreciated.
Pedro Mendes

If you use @Transactional, the commit only happens at the end. Did you use the right configuration? Can you give some info about your setup (Spring boot, regular Spring, how the process engine is configured, etc.).

Hi joram,
First of all, thanks for your answer.
I am using regular Spring to configure the engine (org.flowable.spring.SpringProcessEngineConfiguration) and to instantiate the datasource as well.
The datasource is provided by the application server (Wildfly 14) using JNDI lookup name which then is used to create an entity manager.
Based on this datasource, a transaction manager is also created using Spring (org.springframework.jdbc.datasource.DataSourceTransactionManager).