Hi,
I am currently doing my first steps with Hibernate Envers. So far it looks really impressive! Now, I have a use case, where I need to determine at which revision a given property has changed. Since envers always saves a complete snapshot of an entity, this is not necessarily the latest available revision of that entity.
Here is an example: I have an entity Person that is initially filled with the name "Donald Duck". After that is saved, I modify the surname from "Donald" to "Dagobert". This gives the following audit table for the Person entity:
select r.revtstmp, p.* from revinfo r join person_aud p on p.rev = r.rev
revtstmp | id | REV | REVTYPE | REVEND | name | surname | address_id |
1309936938133 | 1 | 2 | 0 | 3 | Duck | Donald | 1 |
1309936938484 | 1 | 3 | 1 | (null) | Duck | Dagobert | 1 |
Now, I want to determine the revision when the name property was last changed. For the example, this would be revision 0.
What I can do with the available data so far is to query all revisions of the entity and then compare the desired property at all revisions until I find a change (or, like in the example, until I find the initial revision).
Is there a possiblity to find that revision with a query instead of having to manually inspect all available revisions?
Thanks for the feedback!
The feature you are writing about is not yet implemented, but I'm planning to introduce it in the future.
(and, Envers is always looking for contributions )
Adam