I have seen this question asked on other forms dated back in 2012 but its now 2019 and I am having this same issue with envers. Has anyone figured this out?!?!?
I am reposting this question from here: envers multi level entity revision howto
User have n Contacts. A Contact can have a localized Comment (Comments are shared between Contacts). Java Beans:
@Audited
@Entity
public class User {
@OneToMany(fetch = FetchType.EAGER,
cascade = CascadeType.ALL,
orphanRemoval = true)
Set<Context> contacts;
}
@Audited
@Entity
public class Contact {
@ManyToOne(fetch = FetchType.EAGER,
cascade = {
CascadeType.MERGE,
CascadeType.PERSIST,
CascadeType.REFRESH})
Comment comment;
}
@Audited
@Entity
public class Comment {
String de;
String en;
String fr;
}
If I change the german localization (Comment.de) of a contact (Contact.comment) then this will create a new revision but not for User. If I ask envers for User Revisions I will never see this "Level 2 change" because the relation between User and Contact was not change, only the german string in the Contact Comment was changed.
But I want see in the User History a new Entry (Changed german comment for contact XYZ).
HAS ANYONE SOLVED THIS?