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:
@@ -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 {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user