5 Replies Latest reply on Feb 18, 2010 8:49 AM by Tim Jones

    Work around for unsupported Annotations

    Midhun Agnihotram Newbie

      Hi All,

       

      I am not sure about the working mechanism of Envers - pardon my ignorance. I have noticed that when I integrate Envers with our application, it gives an error on some existing Annotaions in our POJO classes. Examples being composite keys (@AttributeOverrides) and @DiscriminatorFormula. I think I will get more of these as I annotate more POJOs with @Audited.

       

      Is there any work around for the same ? I would really like to use Envers for Auditing our application. But these seem to be road blocks for the same.

       

      Thanks for the help,

      Midhun.

        • 1. Re: Work around for unsupported Annotations
          Midhun Agnihotram Newbie

          Just to update, I get the following error on an Annotation like this :

           

          @DiscriminatorFormula("case when COL1 IS NULL then 'ABC' else 'XYZ' end")

           

           

          Error:

           

          Caused by: java.lang.ClassCastException: org.hibernate.mapping.Formula
              at org.hibernate.envers.configuration.metadata.MetadataTools.addColumns(MetadataTools.java:177)
              at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateMappingData(AuditMetadataGenerator.java:317)
              at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:424)
              at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:100)
              at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:87)
              at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
              at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:315)
              at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
              at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
              at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
              ... 47 more

          • 2. Re: Work around for unsupported Annotations
            Adam Warski Master

            Well, you could mark such properties with @NotAudited, but then the content won't be audited.

            If you'd like to have these audited, Envers would have to support such mappings.

             

            Adam

            1 of 1 people found this helpful
            • 3. Re: Work around for unsupported Annotations
              Midhun Agnihotram Newbie

              Hi Adam,

               

              Thank you for the reply. But we needed these Entities to be audited (Infact I was testing an important module which needs to be audited and found these errors). Any idea when would Envers be able to support such mappings ?

               

              This is the last chance I have got to try to implement Envers - or else we would be going ahead with the conventional trigger based Audit tables.

               

              Thanks,

              Midhun

              • 4. Re: Work around for unsupported Annotations
                Adam Warski Master

                Well support for these features is on the roadmap but I am not able to tell you when they will be implemented. Most probably when a user submits a patch (maybe you would like to take a look at the source code?) or when I need it .

                 

                There is also commercial support available by SoftwareMill (http://www.softwaremill.eu), which includes new feature development.

                 

                Adam