Enforces to increment the
modificationCounter e.g. to enforce that a parent object gets locked when its children are modified.
As an example we assume that we have the two optimistic locked entities
Order and its contained
OrderPosition. By default the users can modify an
Order and each of its
OrderPositions in
parallel without getting a locking conflict. This can be desired. However, it can also be a demand that an
Order gets approved and the user doing that is responsible for the total price as the sum of the prices of
each
OrderPosition. Now if another user is adding or changing an
OrderPostion belonging to that
Order in parallel the
Order will get approved but the approved total price will differ from what
the user has actually seen when he clicked on approve. To prevent this the use-case to modify an
OrderPosition can use this method to trigger a locking on the associated
Order. The implication is
also that two users changing an
OrderPosition associated with the same
Order in parallel will get a
conflict.