If global "with modified flag" set, you cannot override the value

Description

Typically, when you set a global setting such as the "org.hibernate.envers.audit_table_suffix" property, you can override the value at the class (or field) level. This is not the case with the "org.hibernate.envers.global_with_modified_flag" property; if it is set to false, it will never write modified flags even if fields are annotated like so;
@Audited(withModifiedFlag = true)
private EnrollmentStatus status;

I have attached a basic project where you can turn the flags on/off easily to see this issue.

To test this issue;
-Install the database
-Open "Config.java" and comment out the global property.
-Start "Application.java"
-Navigate to "localhost:8080/test".
-Navigate to "localhost:8080/test" again, the first one would create your initial record, the second is an update. Any subsequent requests are updates and the status field will be modified.
-Check the enrollment2_history table and observe that the modified field is being set properly.
-Now uncomment the global property, and re-run the test case. You'll noticed that the modified flag is never changed to true whether the annotation is on the class level or the field level.

One thing to mention, the example project is very dirty as I was using it to diagnose this problem and it is hacked together and stripped of PII.

Attachments

2

Activity

Show:

AdamA February 29, 2016 at 7:17 AM

Well I suppose that property being unset shouldn't have different behavior than property set to false, so that would need fixing

Steve Ebersole February 27, 2016 at 11:46 PM

, Thoughts on this one?

Brandon mcculligh January 21, 2016 at 8:54 PM

Added a new attachment that handles initial load up.

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Created January 21, 2016 at 8:47 PM
Updated June 2, 2016 at 3:51 AM
Resolved May 12, 2016 at 3:25 AM