We use a multi-column unique constraint and a version tag for optimistic locking. For some columns we want to detect changes and generate entries in other table.
So the setup is following:
*.hbm.xml
And we register and implement a PreUpdateEventListener. This listener will compare old and new values. And will create a new record for every change.
We achive this by getting the state via:
So our testcase:
In Hibernate 4.3.11 we get 2 changes.
In Hibernate 5.0.7 we get 1 change.
So what happens? One change cannot be detected, because our timestamp property only changes in Hibernate 4.3.11? But if we touch normalProp everything works as expected. I assume changes in a property grouped by properties aren't detected, resp. the dirty flag isn't set.
Please provide a test case that reproduces your issue. Please see org.hibernate.test.flush.TestAutoFlushBeforeQueryExecution for an example of a unit test with a custom PreUpdateEventListener.