3

I want to add in my project a list of the revision changes (on click in info icon) like:

Revision X
- added fieldA entry
- modified fieladB from B to BB
- removed fieldC entry
...

Which is the best way?

ps: I already use EntityTrackingRevisionListener.

Thanks.

skaffman
  • 398,947
  • 96
  • 818
  • 769
rogeriolino
  • 1,095
  • 11
  • 21

1 Answers1

0

The best way currently is to load the history of an object (list of historical versions) and compare in Java.

The latest release (4.1) also has support for adding modified flags (boolean, specify if a field was modified or not in that revision): http://docs.jboss.org/hibernate/core/4.1/devguide/en-US/html/ch15.html#envers-tracking-properties-changes

Maybe this could be extended to an ADD/MOD/DEL enum, just as with entities.

adamw
  • 8,038
  • 4
  • 28
  • 32
  • 2
    The most useful thing would be simply to be able to get the list of ALL properties that changed in a revision. You can work out from the RevisionType of the ENTITY and the value of the property whether it was added, modified or deleted (cleared, actually). I would think that is a more obvious use case than knowing whether a specific one changed. – Cornel Masson Aug 27 '12 at 12:50