DATAJPA-608 - JpaPersistentPropertyImpl.isEntity() now uses getActualType().

This commit is contained in:
Oliver Gierke
2014-09-15 14:11:12 +02:00
parent b406904732
commit 6ea82fa1c5
2 changed files with 14 additions and 3 deletions

View File

@@ -115,7 +115,7 @@ class JpaPersistentPropertyImpl extends AnnotationBasedPersistentProperty<JpaPer
public boolean isEntity() {
try {
metamodel.managedType(getType());
metamodel.managedType(getActualType());
return true;
} catch (IllegalArgumentException o_O) {
return false;

View File

@@ -40,8 +40,7 @@ public class JpaMetamodelMappingContextIntegrationTests {
JpaMetamodelMappingContext context;
@PersistenceContext
EntityManager em;
@PersistenceContext EntityManager em;
@Before
public void setUp() {
@@ -84,4 +83,16 @@ public class JpaMetamodelMappingContextIntegrationTests {
property = entity.getPersistentProperty("lastname");
assertThat(property.isEntity(), is(false));
}
/**
* @see DATAJPA-608
*/
@Test
public void detectsEntityPropertyForCollections() {
JpaPersistentEntityImpl<?> entity = context.getPersistentEntity(User.class);
assertThat(entity, is(notNullValue()));
assertThat(entity.getPersistentProperty("colleagues").isEntity(), is(true));
}
}