Persistent entity type detection now starts with the association target type if available.

This causes us to inspect the most concrete type we can find from a property declaration that might be overridden using an annotation.

Closes: #2409
Original Pull Request: #2410
This commit is contained in:
Oliver Drotbohm
2021-07-09 15:09:25 +02:00
committed by Christoph Strobl
parent e565c11dcc
commit d3cd1ab60a
2 changed files with 13 additions and 3 deletions

View File

@@ -436,9 +436,8 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
private Set<TypeInformation<?>> detectEntityTypes(SimpleTypeHolder simpleTypes) {
TypeInformation<?> typeToStartWith = ASSOCIATION_TYPE != null && ASSOCIATION_TYPE.isAssignableFrom(rawType)
? information.getComponentType()
: information;
TypeInformation<?> typeToStartWith = getAssociationTargetTypeInformation();
typeToStartWith = typeToStartWith == null ? information : typeToStartWith;
Set<TypeInformation<?>> result = detectEntityTypes(typeToStartWith);