1 Reply Latest reply on Apr 10, 2013 7:51 AM by Nick .

    Envers Audit annotation is not working

    Nick . Apprentice


           I'm using envers-1.2.2.ga-hibernate-3.3 with hibernate 3.3.1-GA.

      All my Entity classes are mapped using hbm file, I just trying to audit one of my entity field with @Audited.




      public class MyEntity{


           private String name;

           public String getName() {....}

           public void setName(String name){....}



      and this class is mapped using MyEntity.hbm.xml

      and i'm using AnnotationConfiguration to build session factory (even non of my entities are JPA annoated).


      Unfortunatly MyEntity's audit table is not getting created, i'm using hibernate.hbm2ddl.auto value as update in my hibernate.cfg.xml file


      I've tried all possible way to figure out but couldn't able to find any solution. When i debugged

      This particular line in AuditedPropertiesReader#fillPropertyData method

      // Checking if this property is explicitly audited or if all properties are.

                          Audited aud = property.getAnnotation(Audited.class);


      is returning null for my audited field ie name.


      Any help or hint to fix would be appreciated.



        • 1. Re: Envers Audit annotation is not working
          Nick . Apprentice

          Thanks for all who checked this. Finally i'm able to find and fix the issue. I'm posting it over here for those who struggle with similar issue.

          I was using the following code to create the hibernate Configuration object.

          Configuration configuration = new AnnotationConfiguration();

          And found this is the culprit for the issue and the fix is just initialize configuration like below.

          AnnotationConfiguration configuration = new AnnotationConfiguration();