Use contextual information when creating PersistentPropertyPaths.
In oder to preserve contextual information the PersistentPropertyPathFactory now obtains EntityInformation for properties from the MappingContext via their PersistentProperty representation instead of plain the TypeInformation as the former contains more information about the actual type and signatures. Closes #2293. Original pull request: #2294.
This commit is contained in:
committed by
Mark Paluch
parent
54f2d150c5
commit
b51bee7a0b
@@ -222,8 +222,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeInformation<?> type = property.getTypeInformation().getRequiredActualType();
|
||||
return Pair.of(path.append(property), iterator.hasNext() ? context.getRequiredPersistentEntity(type) : entity);
|
||||
return Pair.of(path.append(property), iterator.hasNext() ? context.getRequiredPersistentEntity(property) : entity);
|
||||
}
|
||||
|
||||
private <T> Collection<PersistentPropertyPath<P>> from(TypeInformation<T> type, Predicate<? super P> filter,
|
||||
@@ -236,6 +235,12 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
}
|
||||
|
||||
E entity = context.getRequiredPersistentEntity(actualType);
|
||||
return from(entity, filter, traversalGuard, basePath);
|
||||
}
|
||||
|
||||
private Collection<PersistentPropertyPath<P>> from(E entity, Predicate<? super P> filter, Predicate<P> traversalGuard,
|
||||
DefaultPersistentPropertyPath<P> basePath) {
|
||||
|
||||
Set<PersistentPropertyPath<P>> properties = new HashSet<>();
|
||||
|
||||
PropertyHandler<P> propertyTester = persistentProperty -> {
|
||||
@@ -254,7 +259,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
}
|
||||
|
||||
if (traversalGuard.and(IS_ENTITY).test(persistentProperty)) {
|
||||
properties.addAll(from(typeInformation, filter, traversalGuard, currentPath));
|
||||
properties.addAll(from(context.getPersistentEntity(persistentProperty), filter, traversalGuard, currentPath));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user