3 Replies Latest reply on Jun 26, 2017 1:22 PM by Andreas Haumer

    Please HELP, strange record inserstions with envers

    meher meher Newbie

      Hello everyone,

       

      I am facing a critical bug on envers, i think the records are not inserted correctly (please see below).

      how could a modification have and REVEND = NULL ? (REVTYPE = 1 and REVEND = null)

      Also , the REVEND doesn't seems have the correct value , it should, always, take the previous revision value , i am wrong ?

      How could a deletion (REVTYPE = 2 ) have null for REVEND ?

      I am using spring boot with envers suppport (spring data envers )  and when i got the error i switched to hibernate 5.0.11 but still having the same issue.

      error.PNG

       

       

      Nouvelle image bitmap.png

       

      Please HELP

       

       

        • 1. Re: Please HELP, strange record inserstions with envers
          Andreas Haumer Newbie

          Hi!

           

          You have to provide more information about your problem, otherwise everything would be guesswork!

          How does your data model look like?

          What is the use case where this problem occurs?

          Do you have a working test case to reproduce the problem?

           

          It seems you use the ValidityAuditStrategy because you have a "end revision" field.

           

          All records in the audit tables valid at the current point in time have the REVEND column set to null. This is perfectly normal.

          Only historic records have a not-null value here.

           

          A deleted record (REVTYPE=2) will always have an empty REVEND column, because deleted means "gone forever" :-)

          • 2. Re: Please HELP, strange record inserstions with envers
            meher meher Newbie

            Thank you Andreas for your quick reply,

            In fact when i create an object (which have a ManyToMany relationship with another object), the audit go well , i check in database, records are fine inserted. Next, when i try to modify this object , at this moments, strange things come, it's like a random error , i am expecting to see revisions and its previous in the same record but it's not the case and, thus, the server crashes with error above.

            I've remove ValidityAuditStrategy, things back to normal, but still wondering why i got that issue, i can't find an answer ..

            • 3. Re: Please HELP, strange record inserstions with envers
              Andreas Haumer Newbie

              Hi!

               

              I still think you have to provide more detailled information about your concrete data model and mapping.

              How are the entities mapped, what kind of relationship do they have, what is the table structure, what are the primary keys, ...?

              The exact details are essential here as a small difference in the mapping syntax might have a huge impact on the semantics!

               

              From the screenshots you provided one can not deduce the necessary information to go into this problem.

               

              A working test case, reduced to the minimum would be excellent.

               

              I would also try to use a more recent Envers version. If it's an Envers bug, it might be fixed already.

               

              I'm thinking about [HHH-9199] ValidityAuditStrategy: Collection of embeddables is not audited correctly - Hibernate JIRA  for instance.