DATACMNS-1214 - Fixed AbstractMappingContext.getPersistentEntity(PersistentProperty) to now return null for non-entities.

Previously, a call to AbstractMappingContext.getPersistentEntity(PersistentProperty) would've added potentially leniently added the type of the given PersistentProperty, no matter whether it's actually considered to be an entity in the first place. We now defensively check for whether the given property is to be considered an entity (taking potentially registered converters into account) before the potentially entity-creating by-type lookup.
This commit is contained in:
Oliver Gierke
2017-11-16 16:29:06 +01:00
parent 24c1b823c6
commit e2bac30be4
2 changed files with 22 additions and 11 deletions

View File

@@ -239,6 +239,10 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
Assert.notNull(persistentProperty, "PersistentProperty must not be null!");
if (!persistentProperty.isEntity()) {
return null;
}
TypeInformation<?> typeInfo = persistentProperty.getTypeInformation();
return getPersistentEntity(typeInfo.getRequiredActualType());
}