Description
Hi there, using 7.3.0 when I commit an entity that has shallow references properties (configured via EntityDefinitionBuilder) I get this error:
org.javers.common.exception.JaversException: MANAGED_CLASS_MAPPING_ERROR: given javaClass 'class java.util.LinkedHashSet' is mapped to CollectionType, expected ManagedType
The class in question looks like this
class Entity1 {
Set<Entity2> entity2s;
}
When I check the type mapping, the Set field is mapped to ValueObjectType when it should be CollectionType.
Steps To Reproduce
I will have a PR with some tests ready in a moment. I'm trying to debug it now but I haven't nailed down a solution. It seems that in JaversProperty.isShallowReference(), the call to getType()
causes Set
to be registered as a ValueObjectType. I used only Set in the test but I believe other collection types such as List are affected.
The specific failing test is should map Set field to SetType when entity is registered with shallow properties
in JaversDiffE2ETest. The tests don't do any commits. Instead they check the type mapping.
I have other tests for similar scenarios. The other tests pass, so it seems specific to the new EntityDefinitionBuilder.withShallowProperties method.
Javers' Version
7.3.x