Recently we noticed a change in behavior when we use Hibernate’s @UpdateTimestamp to update the last modified date for entities that also use optimistic locking.
In Hibernate 6.6, @UpdateTimestamp has no effect if only a @ManyToMany relationship is changed on the owner side. The @Version attribute is incremented, but the modification date remains the same.
We have tested the following versions: 5.6.15, 6.6.4, 6.6.20, 7.0.7
In Hibernate 5.6, @UpdateTimestamp is executed when relationships are changed on the owner side.
The behavior change also applies to @ElementCollections with maps.
Changes for @Basic attributes and versioning with @Version are not affected.
Was this change intentional? We can provide unit tests to verify the behavior change.