I'm comparing two objects whose topology looks like this:
Entity
- various simple properties
- Set<ValueObject1>
ValueObject1
- various simple properties
- ValueObject2
ValueObject2
- various simple properties
If I add a new ValueObject1 to the set on an entity that only differs from another already in the set by the ValueObject2 property then Javers detects no change.
I did some debugging and it seems ObjectHasher generates a state snapshot of each ValueObject1 where the ValueObject2 property is only represented by a path (and hence looks the same in every instance of ValueObject1 in the set). Thus the ValueObject2 does not affect the hash generated and Javers does not see the new element in the set.
Although I'm working in Kotlin, I created a Gist that demonstrates the issue using Groovy/Spock: https://gist.github.com/robfletcher/97ad78d06f15c92617d734d227218c01 using a simplified version of the model from my real project.
I'm comparing two objects whose topology looks like this:
If I add a new
ValueObject1to the set on an entity that only differs from another already in the set by theValueObject2property then Javers detects no change.I did some debugging and it seems
ObjectHashergenerates a state snapshot of eachValueObject1where theValueObject2property is only represented by a path (and hence looks the same in every instance ofValueObject1in the set). Thus theValueObject2does not affect the hash generated and Javers does not see the new element in the set.Although I'm working in Kotlin, I created a Gist that demonstrates the issue using Groovy/Spock: https://gist.github.com/robfletcher/97ad78d06f15c92617d734d227218c01 using a simplified version of the model from my real project.