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/runtime/optimistic-locking.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,23 +24,23 @@ For example, if one user commits changes for `AttributeA` and `AttributeB` and a
24
24
25
25
## Behavior of App with Optimistic Locking Enabled
26
26
27
-
The Mendix runtime implements optimistic locking by tracking the version of all objects using the attribute `MxObjectVersion` with type `Long`. Although the `MxObjectVersion` attribute is not write-protected, setting this value will **not** result in it being saved to the database. Its current value will be compared with the value for the same object in the database.
27
+
The Mendix runtime implements optimistic locking by tracking the version of all objects using the attribute `MxObjectVersion` with type `Long`. Although the `MxObjectVersion` attribute is not write-protected, setting this value does not result in it being saved to the database. Its current value is compared with the value for the same object in the database.
28
28
29
29
### How to Enable and Use Optimistic Locking
30
30
31
-
You can enable optimistic locking for your Mendix application in the `Runtime` tab in the App settings dialog:
31
+
You can enable optimistic locking for your Mendix application in the `Runtime` tab in the **App Settings** dialog:
After optimistic locking is enabled, whenever a commit is executed, the Mendix runtime will automatically ensure that the object that is committed was not already changed by another party after the committer retrieved the object.
35
+
After optimistic locking is enabled, whenever a commit is executed, the Mendix runtime automatically ensures that the object that is committed was not already changed by another party after the committer retrieved the object.
36
36
37
37
### New Projects and Migration
38
38
39
-
If an existing app already has the `MxObjectVersion` attribute, a duplicate attribute will be reported in Studio Pro when optimistic locking is enabled. This must be fixed by renaming the existing attribute to another name. The system attribute cannot be renamed.
39
+
If an existing app already has the `MxObjectVersion` attribute, a duplicate attribute is reported in Studio Pro when optimistic locking is enabled. This must be fixed by renaming the existing attribute. The system attribute cannot be renamed.
40
40
41
41
### Behavior
42
42
43
-
The following runtime actions are influenced by optimistic locking:
43
+
The following runtime actions are influenced by optimistic locking.
44
44
45
45
#### Create Object
46
46
@@ -52,7 +52,7 @@ When the `MxObjectVersion` attribute in the object being committed is different
52
52
53
53
#### Delete Object
54
54
55
-
When the `MxObjectVersion` attribute in the object being deleted is different from the value in the database, the runtime throw a `ConcurrentModificationRuntimeException`. Otherwise, it proceeds with the delete. If the object has already been deleted, no error occurs.
55
+
When the `MxObjectVersion` attribute in the object being deleted is different from the value in the database, the runtime throws a `ConcurrentModificationRuntimeException`. Otherwise, it proceeds with the delete. If the object has already been deleted, no error occurs.
Object of type 'MyFirstModule.MyEntity' with guid '3940649673949185' cannot be updated, as it is modified by someone else at MyFirstModule.MyMicroflow (Change : 'Change 'MyEntity'')
74
74
```
75
75
76
-
The above error shows that there was a `ConcurrentModificationRuntimeException`during execution of the change action `Change 'MyEntity'` of the microflow `MyFirstModule.MyMicroflow`. The object had the id `3940649673949185` and was of type `MyFirstModule.MyEntity`.
76
+
This error shows that there was a `ConcurrentModificationRuntimeException`while executing the `Change 'MyEntity'`change action of the `MyFirstModule.MyMicroflow` microflow. The object had the `3940649673949185` ID and was of type `MyFirstModule.MyEntity`.
77
77
78
78
If committing an object causes an optimistic locking error, trying to commit the same object without reloading always results in an optimistic locking error.
79
79
@@ -82,10 +82,10 @@ If the changes are still deemed valid, you can retry the action causing the opti
82
82
1. Change the error handling for that action to either `Custom with Rollback` or `Custom without Rollback`, and do the following steps in the error flow.
83
83
2. If `$latestError/ErrorType` is `com.mendix.systemwideinterfaces.connectionbus.data.ConcurrentModificationRuntimeException`.
84
84
3. Retrieve a fresh copy of the object from the database.
85
-
4. Apply the original changes onto the retrieved copy.
85
+
4. Apply the original changes to the retrieved copy.
86
86
5. Perform the operation again.
87
87
88
-
You can see an example implementation in the image below. The change action has error handling `Custom without Rollback`. If an optimistic locking error is detected, the latest version of the object is retrieved from the database, changes are applied again, and the change action is retried.
88
+
You can see an example implementation in the following image. The change action has error handling `Custom without Rollback`. If an optimistic locking error is detected, the latest version of the object is retrieved from the database, changes are applied again, and the change action is retried.
@@ -97,7 +97,7 @@ You can handle optimistic locking errors in Java actions using similar steps to
97
97
98
98
## Handling Optimistic Locking Errors in the Client
99
99
100
-
If the optimistic locking error is propagated to the client, then you will see the following error: "The data you're trying to save has already been modified by another user. Please refresh the page and try again."
100
+
If the optimistic locking error is propagated to the client, the following error is displayed: "The data you're trying to save has already been modified by another user. Please refresh the page and try again."
0 commit comments