In the end, I found a Java Action called ‘commitInSeparateDatabaseTransaction’ in the CommunityCommons module. This Java action only takes a single object. I duplicated the Java Action and altered it to accept a list instead of a single object (basically just changing the input parameter type). And that’s it!
Java actions are still running in the same transaction as the calling microflow. The changes will only be visible in another context when the transaction is terminated.
There are options to run actions in a seperate transaction. The community commons should have java actions to manually start and end a transaction. But i would be carefull with that.
Did you consider using the process queue and do the actual processing there? Your scheduled event could retrieve the batch that is supposed to be processed, set the flag and create a Queued Action for this batch. At this moment, the transaction is done and the changes (the processing flag) will be reflected in the database. The process queue would now pick up the queued action and do the actual processing on your objects.