Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting modified properties by revision

I am using Hibernate Envers to audit my entities and properties (org.hibernate.envers.global_with_modified_flag=true). This seems to work, but now I'd like to get all properties of a specific entity which changed at a given revision, compared to the previous one. As a bonus, it would be nice to get the changeset from one revision to another one. So far, I only get the modified entities:

List<Object> modifiedClassesAtRevision = getAuditReader().getCrossTypeRevisionChangesReader().findEntities(revision, RevisionType.MOD)
Object modifiedObject = modifiedClassesAtRevision.get(0);

Now, since I do not want to create comparison methods for all entities in Java, is there any way to get the modified properties of this revision? Something along the lines of

List<String> modifiedProperties = getAuditReader().getModifiedProperties(modifiedObject, revision);

would be nice to have - but maybe I am just too stupid to find that kind of feature.

like image 794
Dominik Sandjaja Avatar asked Feb 12 '13 11:02

Dominik Sandjaja


1 Answers

Currently it's only possible to query for entities where a property was modified, see http://docs.jboss.org/hibernate/core/4.1/devguide/en-US/html/ch15.html#envers-envers-tracking-properties-changes-queries.

Getting a descriptor (changeset) of which properties changed is not yet possible.

like image 147
adamw Avatar answered Oct 17 '22 23:10

adamw