|
29 | 29 | import java.util.concurrent.locks.ReentrantReadWriteLock;
|
30 | 30 | import java.util.function.Predicate;
|
31 | 31 | import java.util.stream.Collectors;
|
| 32 | +import java.util.stream.StreamSupport; |
32 | 33 |
|
33 | 34 | import org.springframework.beans.BeanUtils;
|
34 | 35 | import org.springframework.beans.BeansException;
|
|
57 | 58 | import org.springframework.data.spel.ExtensionAwareEvaluationContextProvider;
|
58 | 59 | import org.springframework.data.util.ClassTypeInformation;
|
59 | 60 | import org.springframework.data.util.KotlinReflectionUtils;
|
| 61 | +import org.springframework.data.util.NullableWrapperConverters; |
60 | 62 | import org.springframework.data.util.Optionals;
|
61 | 63 | import org.springframework.data.util.Streamable;
|
62 | 64 | import org.springframework.data.util.TypeInformation;
|
@@ -482,6 +484,9 @@ protected boolean shouldCreatePersistentEntityFor(TypeInformation<?> type) {
|
482 | 484 | if (simpleTypeHolder.isSimpleType(type.getType())) {
|
483 | 485 | return false;
|
484 | 486 | }
|
| 487 | + if(NullableWrapperConverters.supports(type.getType())) { |
| 488 | + return false; |
| 489 | + } |
485 | 490 |
|
486 | 491 | return !KotlinDetector.isKotlinType(type.getType()) || KotlinReflectionUtils.isSupportedKotlinClass(type.getType());
|
487 | 492 | }
|
@@ -565,7 +570,19 @@ private void createAndRegisterProperty(Property input) {
|
565 | 570 | return;
|
566 | 571 | }
|
567 | 572 |
|
568 |
| - property.getPersistentEntityTypes().forEach(AbstractMappingContext.this::addPersistentEntity); |
| 573 | + StreamSupport.stream(property.getPersistentEntityTypes().spliterator(), false) |
| 574 | + .map(it -> { |
| 575 | + if(it.isNullableWrapper()) { |
| 576 | + return it.getActualType(); |
| 577 | + } |
| 578 | + return it; |
| 579 | + }) |
| 580 | + .filter(it -> { |
| 581 | + |
| 582 | + boolean shouldCreate = AbstractMappingContext.this.shouldCreatePersistentEntityFor(it); |
| 583 | + return shouldCreate; |
| 584 | + }) |
| 585 | + .forEach(AbstractMappingContext.this::addPersistentEntity); |
569 | 586 | }
|
570 | 587 | }
|
571 | 588 |
|
|
0 commit comments