Are database commits executed at the end of a main flow or also at the end of sub flows? - Mendix Forum

Are database commits executed at the end of a main flow or also at the end of sub flows?

0

Hi,

 

I always assumed that a database commit is executed at the end of the main microflow, but I have created a test case where this doesn't appear to be true. Mx 10.3.1.

 

1. Commit in main microflow. Consider an object with a boolean attribute. The initial value is false. The first actions sets the boolean to true and commits and refreshes the object. The second action changes the boolean to false. The resulting database value of the boolean is false. This works as expected.

Main mf.png

 

2. Commit in sub flow. I have moved the first change action to a sub microflow. The resulting database value of the boolean is now true. This I did not expect. In the runtime, the boolean is shown as false. But the database value is true (I have checked this by performing a database retrieve and by performing a rollback action).

Sub mf.png

I always assumed the most recent state of the object was committed to the database once the main flow is finished. But from this test I have to conclude that the database commit is finished at the end of the sub microflow and any subsequent changes in the main microflow are not committed. Can anyone explain this behaviour? Is this normal?

 

Thanks!

Posted
0 comments