|
64 | 64 | import org.springframework.data.neo4j.core.schema.RelationshipProperties;
|
65 | 65 | import org.springframework.data.neo4j.core.schema.TargetNode;
|
66 | 66 | import org.springframework.data.neo4j.integration.shared.common.FriendshipRelationship;
|
| 67 | +import org.springframework.data.neo4j.integration.shared.conversion.ThingWithCompositeProperties; |
| 68 | +import org.springframework.data.neo4j.integration.shared.conversion.ThingWithCustomTypes; |
67 | 69 | import org.springframework.data.neo4j.test.LogbackCapture;
|
68 | 70 | import org.springframework.data.neo4j.test.LogbackCapturingExtension;
|
69 | 71 |
|
@@ -496,6 +498,31 @@ void relAnnotationWithoutTypeMustOverwriteDefaultType() {
|
496 | 498 | assertThat(entity.getRelationships()).anyMatch(r -> r.getFieldName().equals("theSuperBike") && r.getType().equals("THE_SUPER_BIKE"));
|
497 | 499 | }
|
498 | 500 |
|
| 501 | + @Test // COMMONS-2390 |
| 502 | + void shouldNotCreateEntityForConvertedSimpleTypes() { |
| 503 | + |
| 504 | + Set<GenericConverter> additionalConverters = new HashSet<>(); |
| 505 | + additionalConverters.add(new ThingWithCustomTypes.CustomTypeConverter()); |
| 506 | + additionalConverters.add(new ThingWithCustomTypes.DifferentTypeConverter()); |
| 507 | + |
| 508 | + Neo4jMappingContext schema = new Neo4jMappingContext(new Neo4jConversions(additionalConverters)); |
| 509 | + schema.setStrict(true); |
| 510 | + schema.setInitialEntitySet( |
| 511 | + new HashSet<>(Arrays.asList(ThingWithCustomTypes.class, ThingWithCompositeProperties.class))); |
| 512 | + schema.initialize(); |
| 513 | + |
| 514 | + assertThat(schema.hasPersistentEntityFor(ThingWithCustomTypes.class)).isTrue(); |
| 515 | + assertThat(schema.hasPersistentEntityFor(ThingWithCompositeProperties.class)).isTrue(); |
| 516 | + |
| 517 | + Neo4jPersistentEntity<?> entity = schema.getPersistentEntity(ThingWithCustomTypes.class); |
| 518 | + assertThat(entity.getPersistentProperty("customType").isEntity()).isFalse(); |
| 519 | + |
| 520 | + entity = schema.getPersistentEntity(ThingWithCompositeProperties.class); |
| 521 | + assertThat(entity.getPersistentProperty("customTypeMap").isEntity()).isFalse(); |
| 522 | + |
| 523 | + assertThat(schema.hasPersistentEntityFor(ThingWithCustomTypes.CustomType.class)).isFalse(); |
| 524 | + } |
| 525 | + |
499 | 526 | static class DummyIdGenerator implements IdGenerator<Void> {
|
500 | 527 |
|
501 | 528 | @Override
|
|
0 commit comments