1 2 Previous Next 16 Replies Latest reply on Mar 28, 2013 4:21 PM by 0x3333

    ValidityAuditStrategy with no audit record

    0x3333 Newbie

      Hi!

       

      I changed to ValidityAuditStrategy but I'm having a issue.

       

      If I try to persist a new entity that have a N:1 relationship with it the ValidityAuditStrategy throw an exception:

       

      Caused by: java.lang.RuntimeException: Cannot find previous revision for entity br.com.unimaquina.erp.dynamic.PnContato_AUD and id 4
      at org.hibernate.envers.strategy.ValidityAuditStrategy.updateLastRevision(ValidityAuditStrategy.java:175)
      at org.hibernate.envers.strategy.ValidityAuditStrategy.perform(ValidityAuditStrategy.java:66)
      at org.hibernate.envers.synchronization.work.AbstractAuditWorkUnit.perform(AbstractAuditWorkUnit.java:74)
      at org.hibernate.envers.synchronization.AuditProcess.executeInSession(AuditProcess.java:114)
      at org.hibernate.envers.synchronization.AuditProcess.doBeforeTransactionCompletion(AuditProcess.java:152)
      at org.hibernate.engine.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:543)
      ... 97 more

      Caused by: java.lang.RuntimeException: Cannot find previous revision for entity br.com.ib8.snowx.Product_AUD and id 4

      at org.hibernate.envers.strategy.ValidityAuditStrategy.updateLastRevision(ValidityAuditStrategy.java:175)

      at org.hibernate.envers.strategy.ValidityAuditStrategy.perform(ValidityAuditStrategy.java:66)

      at org.hibernate.envers.synchronization.work.AbstractAuditWorkUnit.perform(AbstractAuditWorkUnit.java:74)

      at org.hibernate.envers.synchronization.AuditProcess.executeInSession(AuditProcess.java:114)

      at org.hibernate.envers.synchronization.AuditProcess.doBeforeTransactionCompletion(AuditProcess.java:152)

      at org.hibernate.engine.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:543)

      ... 97 more

       

       

      I have some records on the Product entity by there's no record on Product_AUD, because this has been created right now.

       

      The problem occurrs when the _AUD table is empty.

       

      Regards,

       

       

        1 2 Previous Next