Unify entity type detection.
Unified the calculations made for entityTypeInformation and entityTypes in AbstractPersistentProperty. This avoids both calculations getting out of sync. Also we avoid premature calculation abortions if SimpleTypeHolder.isSimpleType(…) returns true for the raw property type. The latter has caused issues for collection properties in Spring Data KeyValue which considers everything in java.util a simple type. Related ticket: #2390.
This commit is contained in:
@@ -295,6 +295,24 @@ class AbstractMappingContextUnitTests {
|
||||
.doesNotContain(List.class, ArrayList.class);
|
||||
}
|
||||
|
||||
@Test // GH-2390
|
||||
void detectsEntityTypeEveneIfSimpleTypeHolderConsidersCollectionsSimple() {
|
||||
|
||||
context.setSimpleTypeHolder(new SimpleTypeHolder(Collections.emptySet(), true) {
|
||||
|
||||
@Override
|
||||
public boolean isSimpleType(Class<?> type) {
|
||||
return type.getName().startsWith("java.util.");
|
||||
}
|
||||
});
|
||||
|
||||
context.getPersistentEntity(WithNestedLists.class);
|
||||
|
||||
assertThat(context.getPersistentEntities()) //
|
||||
.map(it -> (Class) it.getType()) //
|
||||
.contains(Base.class);
|
||||
}
|
||||
|
||||
@Test // GH-2390
|
||||
void shouldNotCreatePersistentEntityForMapButItsGenericTypeArguments() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user