Comparing two collections by using <T> Diff compareCollections(Collection<T> oldVersion, Collection<T> currentVersion, Class<T> itemClass);.
The elements in the collection are the same type.
The elements in the collection are entities.
Expectation:
All objects, identified by global id, that are present in the currentVersion, but missing in oldVersion, are present in the NewObject changes.
Reality:
Some entites, that are new, to not produce a NewObject change.
...
Steps To Reproduce
- Create two collections.
- Add elements to the collection with a different ID, that produces the same hash value. e.g. "FB" and "Ea"
- Compare the two lists by using
<T> Diff compareCollections(Collection<T> oldVersion, Collection<T> currentVersion, Class<T> itemClass);
Javers' Version
7.3.8
Additional context
I identified the root cause of this:
In GraphPair the graphs are built and the comparison in difference is done by using a hasher.
The wrong result happens because 2 different global IDs produce the same hash value.
So the oldVersion contains a different element with the same hash, thus it is not recoignized as a new object in the currentVersion.
Comparing two collections by using
<T> Diff compareCollections(Collection<T> oldVersion, Collection<T> currentVersion, Class<T> itemClass);.The elements in the collection are the same type.
The elements in the collection are entities.
Expectation:
All objects, identified by global id, that are present in the
currentVersion, but missing inoldVersion, are present in theNewObjectchanges.Reality:
Some entites, that are new, to not produce a
NewObjectchange....
Steps To Reproduce
<T> Diff compareCollections(Collection<T> oldVersion, Collection<T> currentVersion, Class<T> itemClass);Javers' Version
7.3.8
Additional context
I identified the root cause of this:
In GraphPair the graphs are built and the comparison in difference is done by using a hasher.
The wrong result happens because 2 different global IDs produce the same hash value.
So the oldVersion contains a different element with the same hash, thus it is not recoignized as a new object in the
currentVersion.