3 Replies Latest reply on Oct 19, 2010 2:28 AM by Adam Warski

    Can envers help solve my problem?

    Charles Lacz Newbie

      I'm working a new project using the Play framework and hibernate to implement a system to manage our testing, both automated and manual tests.  I need to track versions of the data and I'd like to use envers rather than invent my own solution, but I'm not sure it's right for me reading through the documention.


      - If the users are looking at old test plans they should see the test cases as they when that plan is run.  Updates shouldn't affect the old plans.  Can I reference envers versions in my own tables, or is there a better way to handle this?

      - As new test plans are prepared they need to get approved by the managers.  The managers need to be able to pull up a list of changes since the last review.  Envers seems like it would be well suited to this.

      - Each new result needs to be saved and I need to be able to pull a full history, or just the results associated with a specific plan.


      Is envers a good solution?  If so do you have any references you'd recommend.  If it's not, is there another solution you'd recommend?



        • 1. Re: Can envers help solve my problem?
          Adam Warski Master

          Envers will certainly work for the 1st point. If you retrieve a test plan using an audit reader, and you have a relation TestPlan.getTestCases() or if you know the revision number (basing e.g. on a date), you will get the historic test cases.


          As for the second point, Envers doesn't provide a workflow mechanism, or a "future/forward history". It only archives the old versions.


          The third point is also very easy with Envers - it's very simple usage of the audit reader.


          Hope this helps



          1 of 1 people found this helpful
          • 2. Re: Can envers help solve my problem?
            Charles Lacz Newbie

            Regarding the second point, I don't need a workflow mechanism, but if I can give Envers a start and end time/date it can give me all the changes for a the testcases in a plan between those times, right?  From what I've read Envers won't go all the way and tell me what changed with each version.  I'll either need to store that when the change is done or figure it out when I create the report by comparing versions.  The workflow part I know I'll need to write on my own.


            I appreciate the answer.  It looks like envers is probably the right the tool for me to use.

            • 3. Re: Can envers help solve my problem?
              Adam Warski Master

              Yes, having a date, you can obtain a revision number. So if you have start and end dates you can obtain two revision numbers. Then, you can query historical data to return test cases which changed between those revisions (see auditReader.createQuery).


              Figuring out changes is normally pretty straighforward - just compare two objects - normally it's way faster then storing and retrieving it from a DB.