Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Registering entities before referred value type fails (sometimes) #798
We want to compare two instances of a complex datastructure to identify their functional differences. During the usage of JaVers to compare those instances I found a behavior I can not fully explain to myself. It took quiet a while reducing this setup to the essential part. So let's start:
In the reproducer we have two classes
We are using Hibernate hence every class has an property "id". But we do not want to use those as ID for the entities, because those are technical IDs and not functional IDs. So we are ignoring those.
Here is the registration of the classes for the
Having two entities refering to the same value class is one essential part to reproduce the behavior. The second part, which was quiet harder to identify, is the order in which the registered classes are stored in the
To enforce a reliable behavior of the reproducer I changed the datatype of the
So, what happens if all those preconditions are met? In the following lines an
Reason is the entity
In my opinion this is an unexpected behavior and I see two ways to fix this behavior: changing the datatype of the HashMap which will make the registration of types order-dependent. Or assure infered data types are updated correctly. Can you explain this behavior?
Hi @vr-one , interesting investigation, I will try to figure out what's going on in your case. Could you please push your example to your fork of this repo? See how we write test cases - https://github.com/javers/javers/tree/master/javers-core/src/test/groovy/org/javers/core/cases
You have touched the serious problem in javers-core -- mutability of
When Javers starts, somehow,
I need some tome to fix it.