When creating a new Entity and then inserting her in the associated table, the values of the modified flag (column that can be added with org.hibernate.envers.global_with_modified_flag = true ) are unpredictibles.
When you persist the entity at the end of the modification simply like this :
The principle seem to be this one :
each property that is fill with some value get a modified flag to true, every property that remain null get a false modified flag (so here date_mod = true)
But if in the same transaction, you make some changes after the persist's call, like this :
Than it's like the modifications made before the persist are forgotten, and Hibernate-Envers apply the precedent principle only to the changes made between the persist and the update.
So we get date_mod = false , and second_field_mod = true.
It would be nice to have a coherent behavior on the whole changes that are made inside one transaction, and so that the precedent principle be applied to every changes.
Hibernate 5.1, Postgresql, Spring