Hi, I started using enverse for auditing changes in our application. i am able to retrieve revisions at an entity level.
Most of the applications look for viewing the modified properties and not all properties. is there any way where we can store and retrieve list of modified property names and not the entire properties.
This will reduce the load on retrieving the fields to be shown on front end.
It would be of great help if some one can guide me on how can i only store modified properties in a entity and not the entire entity.
I am not sure if this is already available and if available, request you to please provide the pointers to the appropriate one. currently we are using hibernate-core-5.4.3 and good to use any of the available upgraded versions of enverse to start using the audit feature if available in future releases.
Expecting something of this kind:
Map<K,V> getModifiedPropertiesOfEntityAtRevision(Class<?> clazz,Number revision)
As far as I know, this is not directly possible. You can determine this yourself though if you need just that information. Write a query similar to the following:
case when aud.property1 <> (case when nextAud.id.originalId is null then e.property1 else nextAud.property1 end) then 'property1' else null end,
case when aud.property2 <> (case when nextAud.id.originalId is null then e.property2 else nextAud.property2 end) then 'property2' else null end
from Entity_AUD aud
left join Entity_AUD nextAud on nextAud.id.originalId = aud.id.originalId
left join Entity e on e.id = aud.id.originalId
where aud.id.revisionId = :revisionId
Will this feature be available in upcoming releases which makes most of the audit comparison easy and is required…
You can create a feature request for it, and if you are willing to do the work, you can contribute it after a design discussion, but the Hibernate team will probably not add this feature without community involvement or a customer paying for this.
This is more of a native which i am against. However, this works temporarily. Will raise a feature request and if possible, work on it to be made available.