0 Replies Latest reply on Dec 12, 2017 6:49 AM by himanshuarora05

    @AuditJoinTable rows missing

    himanshuarora05

      Hi Experts,

      I am new to Hibernate Envers, I've an entities (A & B) which are audited by Envers, which contains one collection.

      Entity A

          @Audited 
          public class A {
          @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
          private int id; ....
         
          @OneToMany @JoinColumn(name = "a_id")
         
      @AuditJoinTable(name = "A_B_AUDIT" ,inverseJoinColumns = @JoinColumn(name = "a"))
          private List<B> bs; ....
      }

      Entity B

       @Audited 
      public class B {
      @Id
      private int id; ....

      @Column(name = "a_id")
      private int aId; 

      @ManyToOne
      @JoinColumn(name = "a_id", insertable = false, updatable = false)
      private A a;
      }

       

      When I run my project following tables gets created :

      A_AUDIT

      B_AUDIT

      A_B_AUDIT

      I've separate controllers to persist A object and B Object. When I try to save B with aId and A, audit_table (A_B_AUDIT) does not gets updated but B_AUDIT with updated revision gets updated.

      Can someone please let me know what i am missing here.

      Thank you !!

      Hibernate Enver Version : 5.1.4.Final