From Javers.org
Each Entity instance has a global identifier called InstanceId. It consists of a class name and an ID value.
Comparing strategy for Entity references is based on InstanceId and for Entity state is property-by-property.
Entity can contain ValueObjects, Entity references, Containers, Values and Primitives.
Now I want to diff two entity objects, actually two versions of the same object, but the Javer will directly judge them to be old object and new object. Can not compare their value.
@Entity
public class Person {
@Id
private Integer id;
private String name;
private Integer age;
}
PersonOne(1, "Tom", 20);
PersonTwo(2,"Jerry", 18);
Is there a way to compare such two objects?
You can tell JaVers to compare these objects as ValueObjects (property-by-property):
javersBuilder.registerValueObject(Person.class)