DATACMNS-597 - Fixed to strict consistency check in PersistentPropertyAccessor lookup.

BasicpersistentEntity now allows subtypes to be handed into the PersistentPropertyAccessor lookup to support inheritance hierarchies as well as interface based PersistentEntity scenarios.
This commit is contained in:
Oliver Gierke
2014-11-19 17:05:50 +01:00
parent 3446c457d5
commit 2388b6fa90
2 changed files with 15 additions and 1 deletions

View File

@@ -210,6 +210,18 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
entity.getPropertyAccessor("foo");
}
/**
* @see DATACMNS-597
*/
@Test
public void supportsSubtypeInstancesOnPropertyAccessorLookup() {
SampleMappingContext context = new SampleMappingContext();
PersistentEntity<Object, SamplePersistentProperty> entity = context.getPersistentEntity(Entity.class);
assertThat(entity.getPropertyAccessor(new Subtype()), is(notNullValue()));
}
private BasicPersistentEntity<Person, T> createEntity(Comparator<T> comparator) {
return new BasicPersistentEntity<Person, T>(ClassTypeInformation.from(Person.class), comparator);
}
@@ -232,4 +244,6 @@ public class BasicPersistentEntityUnitTests<T extends PersistentProperty<T>> {
return property;
}
}
static class Subtype extends Entity {}
}