Given an Entity that is 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;
}
As per their documentation Envers stores the audit information for additions and deletions to these AuditJoinTables (A_B_AUDIT). But Unfortunately, this is not working and the rows inside the tables are missing.
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