Search code examples
javers

Is there a way to see what property is a NewObject change referring to in Javers?


When handling onNewObject(NewObject change) of the ChangeProcessor interface, is there a way to figure out where in the object graph (relative to the top objects compared) that new object is? The full path, not just relative to the immediate parent?

I have two properties of type Address somewhere lower in the graph, and if I print the change global ID, I get something like ...Address/22984 and ...Address/22985, which doesn't tell me what each of those Address objects represent. I'd need to get the full path back up to the root object that shows in javers.initial(rootObject).


Solution

  • JaVers dosn't record paths from the first object but for Value Objects, you can read the path recorded in ValueObjectId. It's the path from an owning Entity to a Value Object. For example:

    Employee/1#primaryAddress