-
1. Re: Entity Audited Without Modifications
adamw Jun 1, 2011 3:58 PM (in response to ciaran.hanley)So the field is modified in Java (null -> ""), but is not modified from an Oracle point of view?
As a work-around maybe you can create an @PreUpdate, @PreInsert event to set the empty-string names to nulls.As a proper fix, I supose we should make a special-case for Oracle? Or maybe this is already somehow encapsulated in the Hibernate Dialect object, and Envers just needs to use it. Anyway, thanks for reporting the issue and please create a JIRA for that. And if you would like to contribute a fix ...
Adam
-
2. Re: Entity Audited Without Modifications
ciaran.hanley Jun 2, 2011 5:22 AM (in response to adamw)Hi Adam,
Yes that is correct. The entity is loaded and the property is set from null to empty string. The entity is then persisted. Next time the entity is loaded the field will have value null as Oracle stores empty string as null.
As the object has changed state (null -> ""), the dirty flag must be set on the entity and Hibernate adds an update to the action queue which in turn raises the PostUpdateEvent to the Envers listener.
I had a quick look at the Oracle Dialect and could not see anything of use there. It seems to be more of an issue with Hibernate not being able to recognize that null -> "" should not result in an update if an Oracle Dialect is being used, rather than something in Envers. Would you agree?
Thanks,
Ciaran
-
3. Re: Entity Audited Without Modifications
ciaran.hanley Jun 2, 2011 6:23 AM (in response to ciaran.hanley)After some further googling it seems using a custom user type has been previously recommended
https://forum.hibernate.org/viewtopic.php?f=1&t=965579&view=next
It seems like a lot of work to implement such a solution as we have hundreds of entities in the application.