Tranasactions in Mendix

Hello Guys,   I have questions regarding transaction and database transactions: When a transaction starts and ends. When a database transaction starts and ends.  Please answer as per the number marked in the MF. 
3 answers



The database commit starts at the end of your Microflow. (nr 7)


When you commit an object, the current value is saved. This means that you cannot roll back to the previous values of the object using the rollback object activity of a microflow.

However, a Mendix commit is not the same as a database commit. For an object of a persistable entity, the saved value is not committed to the database until the microflow and any microflows from which it is called, complete. This means that errors in a microflow can initiate a rollback. If a microflow activity errors and has Error handling set to Rollback or Custom with rollback, the value of the object is rolled back to the value it had at the start of the microflow. See Error Handling in Microflows for more information.


Go Make It


Hey Sahil,

Mendix has some pretty detailed explanations on how transactions in microflows work. Including how they work when using custom error handling. I would read through this documentation for the best answer to your question.


Mendix will start a database transaction for each invocation from a user (or external system) containing an action which involves database interaction. The transaction will be started at the first database action.

transactions typically end when the commit or rollback operation is executed. In the context of Mendix, a transaction refers to a unit of work that is performed against a database.

In Mendix, transactions typically end with the completion of the logic execution, not necessarily with the last database interaction.