8 Replies Latest reply on Nov 9, 2010 9:02 AM by mausbull

    Validity audit strategy - Hibernate 3.3

    mausbull

      Hi,

       

      As I'm still working with Hibernate 3.3 and doing heavy time-consuming queries with envers, I wondered if the new "valid audit strategy" will be merged to the 3.3 branch?

       

      Moreover, is there a way to migrate data from the "default audit strategy" to the "valid audit strategy"?

       

      Thanks a lot for your help,
      Stephan

        • 1. Re: Validity audit strategy - Hibernate 3.3
          adamw

          Hello,

           

          no, I don't have any plans to maintain the 3.3 branch.

           

          Migrating from default to validity is possible and quite easy, with a simple query on the audit table. Although the queries aren't generated automatically yet.

           

          Adam

          • 2. Re: Validity audit strategy - Hibernate 3.3
            fbascheper

            Hi,

             

            Migrating the code base and the tables is easy. All you need to do is set the configuration properties and add the revend column, with a FK to the revision table. I've got plans to create a migration script for existing audit data but I haven't had time to work this out yet.

             

            Regards,

            Erik-Berndt

            • 3. Re: Validity audit strategy - Hibernate 3.3
              mausbull

              Hi,

               

              thanks for the answers. Can the migration of the queries also be done quite easily? Have you already done some migration work or do you have some code pointers?
              I'm really interested in having this strategy/query performance upgrade in the 3.3 branch.

               

              Thanks,
              Stephan

              • 4. Re: Validity audit strategy - Hibernate 3.3
                adamw

                What queries do you have in mind?

                 

                If you prepare a patch which adds validity audit strategy support to 3.3, I'll be very happy to commit it

                 

                Adam

                • 5. Re: Validity audit strategy - Hibernate 3.3
                  mausbull

                  Hi,

                   

                  I'm currently working on the patch that adds validity audit strategy to the 3.3 branch. Hope to finish it this week.

                   

                  Does anyone already have a migration script to modify already existing tables and data?

                   

                  Thanks,
                  Stephan

                  • 6. Re: Validity audit strategy - Hibernate 3.3
                    mausbull

                    Hi,

                     

                    I've created now a patch for 3.3 that should include the validity audit strategy (tests are all passing).
                    Where should I upload it? Can anyone have a look at it to proove that everything is ok?

                     

                    I've also created a small perl script that updates the database tables. I can upload that too.

                     

                     

                     

                    However, my "problematic" query is still pretty slow, maybe because envers is not eagerly fetching the object graph. The graph looks something like this:

                     


                    - A -| B -| C -| D
                                  -| D
                             -| C
                             -| C   
                         | B
                         | B     
                         | B

                     

                    A has ~ 2000 Bs; Each B has ~ 10 Cs; Each C has ~ 5 Ds; ...

                     

                    I've done some perfomance tests where I loaded A with (1) a standard hibernate query and eager loading annotations and (2) an envers query.
                    The results are

                     

                    test 1:
                    - hibernate query: 1069ms.
                    - envers query: 87194ms.

                     

                    test 2:
                    - hibernate query: 2847ms.
                    - envers query: 34350ms.

                     

                    test 3:
                    - hibernate query: 3785ms.
                    - envers query: 864326ms.

                     

                    Is there a way to speed up envers when loading such structures?

                     

                    Thanks for your help,
                    Stephan

                    • 7. Re: Validity audit strategy - Hibernate 3.3
                      adamw

                      Hello,

                       

                      please create a JIRA issue (or better, two: one for VAS, one for the script) and attach the patches there.

                       

                      As for the queries, Validity AS only gives the possibility to speed them up, but it's not yet implemented.

                       

                      Adam

                      • 8. Re: Validity audit strategy - Hibernate 3.3
                        mausbull

                        Hi,

                         

                        I've created 2 JIRA issues

                        VAS: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5720 (sorry for the typo, was a bit too quick with the return key)

                        Patch: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5721

                         

                         

                        ad queries - I see. Hope that there will be a patch in the future ;-)

                         

                        Best wishes,

                        Stephan