diff --git a/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java b/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java index a60b24eedf..a0ac87b813 100644 --- a/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java +++ b/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java @@ -39,7 +39,7 @@ import org.springframework.util.Assert; /** - * {@link JpaPersistentProperty} implementation usind a JPA {@link Metamodel}. + * {@link JpaPersistentProperty} implementation using a JPA {@link Metamodel}. * * @author Oliver Gierke * @author Thomas Darimont @@ -130,10 +130,19 @@ public Class getActualType() { */ @Override public Iterable> getPersistentEntityTypes() { + return getPersistentEntityTypeInformation(); + } + + /* + * (non-Javadoc) + * @see org.springframework.data.mapping.model.AbstractPersistentProperty#getPersistentEntityTypeInformation() + */ + @Override + public Iterable> getPersistentEntityTypeInformation() { return associationTargetType != null // ? Collections.singleton(associationTargetType) // - : super.getPersistentEntityTypes(); + : super.getPersistentEntityTypeInformation(); } /* @@ -219,22 +228,22 @@ public boolean isEmbeddable() { /* * (non-Javadoc) - * @see org.springframework.data.mapping.model.AnnotationBasedPersistentProperty#getAssociationTargetType() + * @see org.springframework.data.mapping.model.AnnotationBasedPersistentProperty#getAssociationTargetTypeInformation() */ @Override - public Class getAssociationTargetType() { + public TypeInformation getAssociationTargetTypeInformation() { if (!isAssociation()) { return null; } if (associationTargetType != null) { - return associationTargetType.getType(); + return associationTargetType; } - Class targetType = super.getAssociationTargetType(); + TypeInformation targetType = super.getAssociationTargetTypeInformation(); - return targetType != null ? targetType : getActualType(); + return targetType != null ? targetType : getActualTypeInformation(); } /** diff --git a/src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java b/src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java index 1a4f219c83..2c98720dce 100644 --- a/src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java +++ b/src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java @@ -144,7 +144,7 @@ void considersTargetEntityTypeForPropertyType() { assertThat(property.getType()).isEqualTo(Api.class); assertThat(property.getActualType()).isEqualTo(Implementation.class); - Iterable> entityType = property.getPersistentEntityTypes(); + Iterable> entityType = property.getPersistentEntityTypeInformation(); assertThat(entityType.iterator().hasNext()).isTrue(); assertThat(entityType.iterator().next()) .isEqualTo(ClassTypeInformation.from(Implementation.class));