You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/refguide/modeling/application-logic/microflows-and-nanoflows/activities/object-activities/committing-objects.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,22 +112,22 @@ Non-persistable entities behave like the in-memory version of a persistable obje
112
112
113
113
### Committing Objects
114
114
115
-
When you commit an object which is in memory, all changes to the database values are saved. Once it is committed, you cannot roll back to the previous values of the object using the **Rollback object** activity of a microflow.
115
+
When you commit an object which is in memory, changes to the values are saved in the database. Once it is committed, you cannot roll back to the previous values of the object using the **Rollback object** activity of a microflow.
116
116
117
117
However, a Mendix commit is not the same as a database (SQL) COMMIT. When you use a **Commit object(s)** activity, Mendix actually performs an INSERT or UPDATE on the database. For an object of a persistable entity, the database COMMIT is not performed until the microflow and any microflows from which it is called, complete. This means that, although a retrieve from the database by the end-user's app will see the updated version of the object, the updated object will not be seen globally by other end-users until the microflows end.
118
118
119
-
Another consequence of this distinction is that, in contrast to an explicit **Rollback object** call, which rolls back to the last Mendix commit, errors in a microflow can initiate a database rollback. If a microflow activity errors and has **Error handling** set to **Rollback** or **Custom with rollback**, the value of the object in the database is rolled back to the value it had at the last savepoint. See [Error Handling in Microflows](/refguide/error-handling-in-microflows/) for more information.
119
+
Another consequence of this distinction is that, in contrast to an explicit **Rollback object** call, which rolls back to the last Mendix commit, errors in a microflow can initiate a database rollback. If a microflow activity errors and has **Error handling** set to **Rollback** or **Custom with rollback**, the value of the object in the database is rolled back to the value it had at the last savepoint. The object in memory will, however, keep any changes to the values. See [Error Handling in Microflows](/refguide/error-handling-in-microflows/) for more information.
120
120
121
121
#### What Gets Committed
122
122
123
123
When you work on an object in memory, Mendix records whether the object has been changed. When you perform a **Commit object(s)** activity, changes to the current values are written to the database and Mendix marks the object as unchanged in memory. This has a couple of consequences that you might not expect:
124
124
125
-
* If you commit an object which is then rolled back due to an error, committing the object again will not write the latest version to the database. You can understand this as the following sequence (see [Error Handling in Microflows](/refguide/error-handling-in-microflows/) for a more detailed discussion of how rollbacks work during error handling):
125
+
* If you commit an object and the transaction is then rolled back due to an error, committing the object again will not write the latest version to the database. You can understand this as the following sequence (see [Error Handling in Microflows](/refguide/error-handling-in-microflows/) for a more detailed discussion of how rollbacks work during error handling):
126
126
127
127
1. Your microflow starts and creates a savepoint.
128
128
1. You change your object in memory – it is marked as changed.
129
129
1. You perform a **Commit object(s)** activity which sends the changes to the database – the object in memory is marked as unchanged.
130
-
1. An error occurs after the **Commit object(s)** has successfully sent changes to the database – the microflow ends and data in the database is rolled back to the savepoint.
130
+
1. An error occurs in an activity after the **Commit object(s)** activity has successfully sent changes to the database – the microflow ends and data in the database is rolled back to the savepoint.
131
131
1. You perform a **Commit object(s)** on the object again, but the changes are not written to the database because:
132
132
133
133
* The object in memory still has your changes but it was marked as unchanged after your previous commit
Copy file name to clipboardExpand all lines: content/en/docs/refguide/modeling/application-logic/microflows-and-nanoflows/microflows/error-handling-in-microflows.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,8 +28,8 @@ In summary, the four error handling options do the following:
28
28
29
29
| Option | Behavior |
30
30
| --- | --- |
31
-
| Rollback (default) | Reverts all changes, aborts the microflow, and returns the error to the calling microflow. |
32
-
| Custom with rollback | Reverts all changes and follows the error flow. |
31
+
| Rollback (default) | Reverts all database changes, aborts the microflow, and returns the error to the calling microflow. |
32
+
| Custom with rollback | Reverts all changes and follows the error flow. |
33
33
| Custom without rollback | Keeps all changes made before the error and follows the error flow. |
34
34
| Continue | Keeps all changes and continues the microflow as if no error occurred. No error is logged or shown to the end-user. |
35
35
@@ -49,7 +49,7 @@ You can also include decisions in the error handling flow based on what you want
49
49
50
50
It is important to know that when a microflow is started by an end-user (for example, by clicking a button), a savepoint is always created at the very beginning of the microflow. This is the case for **Microflow 1** in all the following examples. Knowing how savepoints are created and function is key to understanding how error handling works.
51
51
52
-
In the following subsections, we introduce the functionality of each error handling option using simple examples. In the examples we have an activity which generates the error. In a real app, however, an error can be generated by any activity. Any changes which happen within the activity which fails will not be applied (for example, if a [Call REST Service](/refguide/call-rest-action/) returns an error, any data the REST call retrieved will not be kept). The error handling only applies to activities which happened before the activity which errors.
52
+
In the following subsections, we introduce the functionality of each error handling option using simple examples. In the examples we have a microflow call which generates the error. In a real app, however, an error can be generated by any activity. No results from the activity which fails will be available (for example, if a [Call REST Service](/refguide/call-rest-action/) returns an error, any data the REST call retrieved will not be kept). The error handling only applies to activities which happened before the activity which errors.
53
53
54
54
### Error Handling - Default
55
55
@@ -83,7 +83,7 @@ When **Microflow 1** starts with a button click, a savepoint is created at the v
83
83
84
84
### Error Handling - Custom without Rollback
85
85
86
-
Setting **Custom without rollback** will not stop data changes within the activity which failed from being rolled back. For example, if a [Call REST Service](/refguide/call-rest-action/) returns an error, any data the REST call retrieved will not be kept.
86
+
Setting **Custom without rollback** will not stop data changes within the actual activity which failed being lost. For example, if a [Call REST Service](/refguide/call-rest-action/) returns an error, any data the REST call retrieved will not be kept.
87
87
88
88
#### Error Handling Which Ends with an End Event
89
89
@@ -102,7 +102,7 @@ In this example, the error handling in **Microflow 2** is set to **Custom withou
102
102
When **Microflow 1** starts with a button click, a savepoint is created at the very beginning of **Microflow 1**. Another savepoint is created right before **GenerateError** because the error handling is set to **Custom without rollback**. When an error occurs in **Microflow 2**, changes made in **Create Order** are at this moment still kept because of the savepoint right before **GenerateError**. A custom error is logged using a **Log message** activity. After that, the error event throws a new error (with the same information as the original error) to terminate **Microflow 2** and, because this error is not handled in **Microflow 1**, rolls back everything to the state of **savepoint 1** which is at the very beginning of **Microflow 1**. Hence, changes made in **Create Customer** and in **Create Order** are both reverted.
103
103
104
104
{{% alert color="info" %}}
105
-
Using custom error handling without rollback and ending the error handling flow with an error event here makes it possible to create a custom log message with details about the **NewOrder** (if you used error handling with rollback, the information about the **NewOrder** would not be available when creating the custom log message). However, after logging this message, everything will still be rolled back as the error event is not handled in **Microflow 1**.
105
+
Using custom error handling and ending the error handling flow with an error event here makes it possible to create a custom log message with details about the **NewOrder**. However, after logging this message, everything will still be rolled back as the error event is not handled in **Microflow 1**.
106
106
{{% /alert %}}
107
107
108
108
### Error Handling - Continue
@@ -207,7 +207,7 @@ This applies to data held within your app and its database. Calls to external sy
207
207
208
208
While updating or creating your objects, you do not want other end-users to see updated information until your microflow has finished executing.
209
209
210
-
To ensure that every end-user or process can only see persisted data, data changed in a microflow is only available within that microflow. None of the changes made inside the microflow will be available outside the microflow, not even to the end-user that initiated the microflow. The information will only be available to all end-users of the application once the microflow has successfully completed all the activities.
210
+
To ensure that every end-user or process can only see persisted data, data changed and committed in a microflow is not made available to all end-users of the application until the top-level microflow has successfully completed all the activities. Before then, only the end-user running the microflow has access to the data.
0 commit comments