When using [this|https://vladmihalcea.com/how-to-increment-the-parent-entity-version-whenever-a-child-entity-gets-modified-with-jpa-and-hibernate] proposal from @Vlad Mihalcea, updating multiple fields from multiple childs in one transaction increases the version number not by one but by the number of changed child entities.
My understanding is, that the version number should be updated only once for one transaction even if the {{OPTIMISTIC_FORCE_INCREMENT}} or {{PESSIMISTIC_FORCE_INCREMENT}} lock modes are used multiple times in it. |
|