I am trying to integrate Javers with a Spring Data REST project. Currently I have the following entities in my domain.
Student.class
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String firstName;
private String lastName;
private Long dob;
@OneToOne
private Gender gender;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "student", orphanRemoval = true)
private List<ContactNumber> contactNumbers = new ArrayList<>();
}
ContactNumber.class
@Entity
public class ContactNumber {
@Id
@GeneratedValue
private Long id;
private String phoneNumber;
private Boolean isPrimary;
@ManyToOne
private Student student;
}
In the javers docs it is mentioned that:
In the real world, domain objects often contain various kind of noisy properties you don’t want to audit, such as dynamic proxies (like Hibernate lazy loading proxies), duplicated data, technical flags, auto-generated data and so on.
So does that mean I put a @DiffIgnore
on the @ManyToOne
student field in the contact number class or the @OneToMany
contacts field in the student class?