Is Java Action StartTransaction required when working with batches?
Hi all, In a microflow I am validating, matching and processing large numbers of records. For this I am using batches that I commit per cycle. Since the data needs to be re-evaluated/reused later in the flow (second DB retrieve is using a subset of the first - updated - list), as well as for performance reasons, I added the java call 'EndTransaction'. Is it good practice/advisable to include a StartTransaction at the begin of each batch as well? If you add a StartTransaction, will the EndTransaction only end the related start (see next question)? In the modelshare sample, you can see sub microflows. In one case, I again may want to retrieve and process a larger number of records. If I add a Start- and EndTransaction in the subMF, will this affect the 'main' transaction? Thank you in advance for all your remarks and ideas. Micha Friede https://modelshare.mendix.com/models/8c03154f-64f0-4aa0-a554-82724ac000cb/main-flow-java-call-start-end-transaction
No, you do not need the Java actions. The Java actions are only needed if another process outside of the microflow already needs the changed data. Because other processes would only see the data after the whole microflow is done. In your case the second retrieve is inside your microflow and hence has the data from the first iteration.
If you do want to create a seperate transaction in your microflow you should always use both the start and the end transaction. Otherwise I think you might create a memory leak. So always use a start transaction before you use an end transaction.