|
19 | 19 | import static org.neo4j.cypherdsl.core.Cypher.asterisk;
|
20 | 20 | import static org.neo4j.cypherdsl.core.Cypher.parameter;
|
21 | 21 |
|
22 |
| -import java.beans.PropertyDescriptor; |
23 | 22 | import java.util.ArrayList;
|
24 | 23 | import java.util.Collection;
|
25 | 24 | import java.util.Collections;
|
@@ -333,11 +332,9 @@ public <T, R> R saveAs(T instance, Class<R> resultType) {
|
333 | 332 | }
|
334 | 333 |
|
335 | 334 | ProjectionInformation projectionInformation = projectionFactory.getProjectionInformation(resultType);
|
336 |
| - List<PropertyDescriptor> inputProperties = projectionInformation.getInputProperties(); |
337 |
| - Set<PropertyPath> pps = new HashSet<>(); |
338 |
| - for (PropertyDescriptor inputProperty : inputProperties) { |
339 |
| - PropertyFilterSupport.addPropertiesFrom(resultType, resultType, projectionFactory, pps, inputProperty.getName(), neo4jMappingContext); |
340 |
| - } |
| 335 | + Collection<PropertyPath> pps = PropertyFilterSupport.addPropertiesFrom(resultType, resultType, |
| 336 | + projectionFactory, neo4jMappingContext); |
| 337 | + |
341 | 338 | T savedInstance = saveImpl(instance, pps);
|
342 | 339 | if (projectionInformation.isClosed()) {
|
343 | 340 | return projectionFactory.createProjection(resultType, savedInstance);
|
@@ -499,11 +496,11 @@ public <T, R> List<R> saveAllAs(Iterable<T> instances, Class<R> resultType) {
|
499 | 496 | }
|
500 | 497 |
|
501 | 498 | ProjectionInformation projectionInformation = projectionFactory.getProjectionInformation(resultType);
|
502 |
| - List<PropertyPath> pps = new ArrayList<>(); |
503 |
| - for (PropertyDescriptor inputProperty : projectionInformation.getInputProperties()) { |
504 |
| - PropertyFilterSupport.addPropertiesFrom(commonElementType, resultType, projectionFactory, pps, inputProperty.getName(), neo4jMappingContext); |
505 |
| - } |
506 |
| - List<T> savedInstances = saveAllImpl(instances, pps); |
| 499 | + |
| 500 | + Collection<PropertyPath> pps = PropertyFilterSupport.addPropertiesFrom(resultType, commonElementType, |
| 501 | + projectionFactory, neo4jMappingContext); |
| 502 | + |
| 503 | + List<T> savedInstances = saveAllImpl(instances, new ArrayList<>(pps)); |
507 | 504 |
|
508 | 505 | if (projectionInformation.isClosed()) {
|
509 | 506 | return savedInstances.stream().map(instance -> projectionFactory.createProjection(resultType, instance))
|
@@ -898,12 +895,9 @@ <T, R> List<R> doSave(Iterable<R> instances, Class<T> domainType) {
|
898 | 895 |
|
899 | 896 | Class<?> resultType = TemplateSupport.findCommonElementType(instances);
|
900 | 897 |
|
901 |
| - ProjectionInformation projectionInformation = projectionFactory.getProjectionInformation(resultType); |
902 |
| - List<PropertyDescriptor> inputProperties = projectionInformation.getInputProperties(); |
903 |
| - Set<PropertyPath> pps = new HashSet<>(); |
904 |
| - for (PropertyDescriptor inputProperty : inputProperties) { |
905 |
| - PropertyFilterSupport.addPropertiesFrom(domainType, resultType, projectionFactory, pps, inputProperty.getName(), neo4jMappingContext); |
906 |
| - } |
| 898 | + Collection<PropertyPath> pps = PropertyFilterSupport.addPropertiesFrom(resultType, domainType, |
| 899 | + projectionFactory, neo4jMappingContext); |
| 900 | + |
907 | 901 | List<R> results = new ArrayList<>();
|
908 | 902 | for (R instance : instances) {
|
909 | 903 | EntityFromDtoInstantiatingConverter<T> converter = new EntityFromDtoInstantiatingConverter<>(domainType, neo4jMappingContext);
|
|
0 commit comments