Interceptor.onFlushDirty is called for unchanged object update with SelectBeforeUpdate

Description

When Entity is SelectBeforeUpdate, Interceptor.onFlushDirty should not be called for unchanged object update. However, onFlushDirty is wrongly called if the Entity has ManyToOne association with JoinColumn(updatable=false)

This bug is very serious because onFlushDirty is usually used to track audit logging (who updated the record and when.) With this bug, all updates result in audit logging even when they are unchanged!

This bug has been around since Hibernate 3.5.5. I am unable to upgrade Hibernate above 3.5.4 because of this issue.

Environment

None

Activity

Show:
Taro App
October 30, 2015, 8:18 AM

Test case attached. Note that the test succeeds if updatable = false is removed from @JoinColumn of Book.java. (So we know the @JoinColumn(updatable=false) caused the issue.)

Taro App
July 6, 2016, 6:06 AM

Tested with 5.2.1 Final and the issue still exists.

Taro App
August 19, 2016, 2:53 AM

Tested with 5.2.2 Final and the issue still exists.

Chris Cranford
August 20, 2016, 1:58 AM

Fixed by HHH-5908.

Assignee

Chris Cranford

Reporter

Taro App

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure