4 Replies Latest reply on Jun 29, 2010 3:50 AM by vipavel

    Auditing changes in related objects

    vipavel

      Hi,

      We have a requirement to create a versioning for our project and I've found that envers can help us.

      There is a tree of objects that I need to maintain.

      As I can see envers can create revisions for each changed object but what happens to the parent when one of the children has been changed?

      To which revision it points?

       

      Thanks,

      Pavel

        • 1. Re: Auditing changes in related objects
          adamw

          If a child changes, an entry is created in the audit tables corresponding to the child entity. There are no entries for the parent. However, the entries in the audit tables do not contain any "hard links".

           

          If you now read a child at revision X, and request the parent (e.g. child.getParent()), the parent entity will be read at revision X as well, through a proxy.

           

          Adam

          • 2. Re: Auditing changes in related objects
            vipavel

            Thanks for the reply.

             

            Let's say I have a label field that will be common for all the objects and will be updated when I save the whole structure.

            In this case what is the best way to get the tree from the "history" tables by this field (kind of revert operation)?

            • 3. Re: Auditing changes in related objects
              adamw

              I don't quite understand ... you can create a query for revisions looking for a specific value of the label field, and getting revision numbers back.

              And then query for objects at that revisions.

               

              Adam

              • 4. Re: Auditing changes in related objects
                vipavel

                Thank you Adam

                Sorry it took so long to post, was busy on other project