3 Replies Latest reply on Dec 30, 2010 8:09 AM by adamw

    Enhance audit entity with additional properties ?

    dokmatik

      Hi,

       

      I am currently experimenting with Envers and was wondering whether additional properties can be added to the audit entities ?

      For example, given an entity Person annoted properly with @Audited I would like to provide some extra properties on an entity basis when auditing is performed.

       

      I would appreciate your ideas.

       

      Regards

      dokmatik

        • 1. Re: Enhance audit entity with additional properties ?
          azagorneanu
          • 2. Re: Enhance audit entity with additional properties ?
            dokmatik

            hi,

             

            thank you for your hint on revision logs. I am aware of revision logs but they might be actually be a workaround to my requirement.

            Rather, I am looking for valid options to attach additional properties / data to audited entities locally.

             

            So far I understand that Envers dynamically generates persistent audit entities using the "map entity mode" at some point of initialization of the session factory. So I guess there must be some way to add additional properties to such metadata maps. Furthermore, I'd expect to extend the default AuditListener by a custom implementation in order to fill these properties at runtime when auditing is performed.

             

            Am I heading into the right direction ?

             

            Regards

            dokmatik

            • 3. Re: Enhance audit entity with additional properties ?
              adamw

              There's no built-in way to add properties to the audit entities, so you would have to modify the Envers source code. If you'd like to do that, then you are heading in the right direction: during the initial configuration, new entities are created using the map entity mode, and then filled with data in *WorkUnit-s created in the AuditListener.

               

              However so far revision logs worked for the use cases that I encountered . What's your use-case?

               

              Adam