Search code examples
javers

Access to ReferenceChange Object References


I am logging changes made in an object graph and am receiving a ReferenceChange (which is correct):

ReferenceChange{globalId:'JaversTest2$BeanWithField/1', property:'integerHolder', oldRef:'JaversTest2$IntegerHolder/4', newRef:'JaversTest2$IntegerHolder/3'}

Is there any way for me to retrieve the actual reference object with the globalId: "JaversTest2$IntegerHolder/4" as I would like to log the actual before and after values?


Solution

  • Short answer is no. If you are using javers.compare(), those objects are available only in ObjectGraph, which is internal JaVers data structure.

    Think about changing your mapping. In this case, if you need values from changed objects try to map them as ValueObjects (not Entities).