Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to detect new value object in a set under specific circumstances #795

Closed
robfletcher opened this issue Feb 25, 2019 · 2 comments
Closed

Comments

@robfletcher
Copy link

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.

@robfletcher robfletcher changed the title Failure to detect new items in a set under specific circumstances Failure to detect new value object in a set under specific circumstances Feb 25, 2019
robfletcher added a commit to robfletcher/keel that referenced this issue Feb 25, 2019
Uncovered a bug, see javers/javers#795 so one of the tests currently fails.
robfletcher added a commit to robfletcher/keel that referenced this issue Feb 26, 2019
Uncovered a bug, see javers/javers#795 so one of the tests currently fails.
bartoszwalacik added a commit that referenced this issue Feb 27, 2019
@bartoszwalacik
Copy link
Member

Hi, thanks for reporting a nice test case. I will check how we can fix it.

@bartoszwalacik bartoszwalacik added the Core Team This issue will be implemented by JaVers core team label Feb 27, 2019
robfletcher added a commit to spinnaker/keel that referenced this issue Feb 27, 2019
Uncovered a bug, see javers/javers#795 so one of the tests currently fails.
bartoszwalacik added a commit that referenced this issue Mar 4, 2019
bartoszwalacik added a commit that referenced this issue Mar 5, 2019
bartoszwalacik added a commit that referenced this issue Mar 6, 2019
bartoszwalacik added a commit that referenced this issue Mar 8, 2019
bartoszwalacik added a commit that referenced this issue Mar 9, 2019
bartoszwalacik added a commit that referenced this issue Mar 10, 2019
bartoszwalacik added a commit that referenced this issue Mar 10, 2019
@bartoszwalacik
Copy link
Member

fix released in 5.2.5

@bartoszwalacik bartoszwalacik removed the Core Team This issue will be implemented by JaVers core team label Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants