4 Replies Latest reply on Jun 29, 2009 4:32 AM by Adam Warski

    Key requrirements - Does Envers address this?

    Ganesh Sethuraman Newbie

      Hi

      I new to envers, but have gone through this forum couple of times, i want to know if envers solves these problem and here are my questions.

      1. Does Envers has ways to store users who created/modified/deleted the entity? In forum i saw some solution to store this information in the entity itself so that it get carried to the aud tables automatically. This we are doing it now, however in the case of delete we still need to know who deleted it. I also saw a reference to "Custom revision entity" is this per table basis? how we can add user from seam context to audit it.

      2. Can Envers has facility to do this auditing in a asynchronous manner? I would imagine that audit requirement generally can have time lag (they are typically not used in the online). Is this possible?

        • 1. Re: Key requrirements - Does Envers address this?
          Adam Warski Master

          Hello,

          1. Yes, that's what the RevisionEntity is for. Generally, I think you'll want to store the user per revision (transaction), not per entity, as typically in one transaction 1 user modifies the entities. So, storing it together with the entity would be duplicating information. Getting that information from a Seam context is very easy, you just need to implement a RevisionListener which looks the appropriate component.

          2. No, the audit entries are written synchronously at the end of the transaction. This guarantees proper ordering (so that newer transactions aren't stored before older ones) and data integrity (that the audit tables always contain proper data). There is some time lag incured by auditing, but it's not very big.

          Adam

          • 2. Re: Key requrirements - Does Envers address this?
            Ganesh Sethuraman Newbie

            Thanks for the quick responce, I somehow did not get the initimation that it is responded.

            One more questions, are there any performance improvement that is done by Envers over and above the normal DB update, like batching of the inserts and updates and things like that?

            • 3. Re: Key requrirements - Does Envers address this?
              Ganesh Sethuraman Newbie

              Also let us know if we can asynchronously post the audit information it to another DB (audit DB), than the destination DB on which the online application is working on. Just to ease-up the load on the destination DB.

              • 4. Re: Key requrirements - Does Envers address this?
                Adam Warski Master

                Envers itself doesn't do any batch optimizations - but as it uses Hibernate, all performance settings done there apply also. So if you specify a batch size in hibernate configuration, this will be used by Envers also.

                As to asynchronously posting the audit information, this is of course possible (eg via JMS or sth like that), but would require code changes (basically when a WorkUnit is executed, instead of calling session.save, you'd have to send the message).

                Maybe you'd be interested in providing a patch which adds such support? :)

                Adam