diff --git a/src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java b/src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java index 0450af7f3..61d882095 100644 --- a/src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java +++ b/src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java @@ -100,6 +100,15 @@ public class JpaMetamodelMappingContext return doFindPersistentPropertyPaths(type, predicate, it -> it.isEmbeddable()); } + /* + * (non-Javadoc) + * @see org.springframework.data.mapping.context.AbstractMappingContext#hasPersistentEntityFor(java.lang.Class) + */ + @Override + public boolean hasPersistentEntityFor(Class type) { + return super.hasPersistentEntityFor(type) || models.isMetamodelManagedType(type); + } + /** * A wrapper for a set of JPA {@link Metamodel} instances to simplify lookups of {@link JpaMetamodel} instances and * managed type checks. @@ -129,13 +138,23 @@ public class JpaMetamodelMappingContext } /** - * Retruns whether the given type is managed by one of the underlying {@link Metamodel} instances. + * Returns whether the given type is managed by one of the underlying {@link Metamodel} instances. * * @param type must not be {@literal null}. * @return */ public boolean isMetamodelManagedType(TypeInformation type) { - return getMetamodelFor(type.getType()) != null; + return isMetamodelManagedType(type.getType()); + } + + /** + * Returns whether the given type is managed by one of the underlying {@link Metamodel} instances. + * + * @param type must not be {@literal null}. + * @return + */ + public boolean isMetamodelManagedType(Class type) { + return getMetamodelFor(type) != null; } /**