Home > Envers, Hibernate, Java, Softwareentwicklung > Good to know this Hibernate Envers API changes

Good to know this Hibernate Envers API changes

Thursday, 19. January 2012 Leave a comment Go to comments

Today I tried to update the hibernate version for an internal customer project from 3.6.0.Final to 3.6.9.Final. In the project we are using Envers to track entity revisions. I already posted about that here.

I noticed that some tests broken with the new version. These tests doing something like this: “create a bean, do changes X times, check available revisions and changed properties from rev A to B”.  In the new version I missed some changed properties.  I’m so happy that we have some tests for that aspect because without them I guess I had found these effects.

I found  this entries in the Envers user forum:

Envers not auditing properties in super class
Envers modification in Hibernate 3.6.8 is causing problems

Then I use the “try and fail” principle to find the latest working version: ONLY 3.6.0.Final works :D

So there was an API change from 3.6.0.Final to 3.6.1.Final. Since 3.6.1.Final Envers doesn’t inspect parent class (es) per default to find out the audit able properties. But it’s easy to fix that:

- put a @Audited to all the base classes
- or use org.hibernate.envers.Audited.auditParents() (if you can’t change the base class)

:)

About these ads
  1. Friday, 20. January 2012 at 7:37 | #1

    Good to know these traps! Thanks

  1. No trackbacks yet.
You must be logged in to post a comment.
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: