|
47 | 47 | import org.neo4j.driver.QueryRunner;
|
48 | 48 | import org.neo4j.driver.Session;
|
49 | 49 | import org.neo4j.driver.Transaction;
|
| 50 | +import org.neo4j.driver.Values; |
50 | 51 | import org.springframework.beans.factory.annotation.Autowired;
|
51 | 52 | import org.springframework.context.annotation.Bean;
|
52 | 53 | import org.springframework.context.annotation.ComponentScan;
|
|
115 | 116 | import org.springframework.data.neo4j.integration.issues.gh2542.TestNodeRepository;
|
116 | 117 | import org.springframework.data.neo4j.integration.issues.gh2572.GH2572Repository;
|
117 | 118 | import org.springframework.data.neo4j.integration.issues.gh2572.GH2572Child;
|
| 119 | +import org.springframework.data.neo4j.integration.issues.gh2576.College; |
| 120 | +import org.springframework.data.neo4j.integration.issues.gh2576.CollegeRepository; |
| 121 | +import org.springframework.data.neo4j.integration.issues.gh2576.Student; |
118 | 122 | import org.springframework.data.neo4j.integration.misc.ConcreteImplementationTwo;
|
119 | 123 | import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
|
120 | 124 | import org.springframework.data.neo4j.repository.query.QueryFragmentsAndParameters;
|
@@ -834,6 +838,34 @@ void getOneShouldNotFailWithoutMatchingRootNodes(@Autowired GH2572Repository GH2
|
834 | 838 | assertThat(gh2572Child).isNull();
|
835 | 839 | }
|
836 | 840 |
|
| 841 | + @Test |
| 842 | + @Tag("GH-2576") |
| 843 | + void listOfMapsShouldBeUsableAsArguments(@Autowired Neo4jTemplate template, @Autowired CollegeRepository collegeRepository) { |
| 844 | + |
| 845 | + var student = template.save(new Student("S1")); |
| 846 | + var college = template.save(new College("C1")); |
| 847 | + |
| 848 | + var pair = Map.of("stuGuid", student.getGuid(), "collegeGuid", college.getGuid()); |
| 849 | + var listOfPairs = List.of(pair); |
| 850 | + |
| 851 | + var uuids = collegeRepository.addStudentToCollege(listOfPairs); |
| 852 | + assertThat(uuids).containsExactly(student.getGuid()); |
| 853 | + } |
| 854 | + |
| 855 | + @Test |
| 856 | + @Tag("GH-2576") |
| 857 | + void listOfMapsShouldBeUsableAsArgumentsWithWorkaround(@Autowired Neo4jTemplate template, @Autowired CollegeRepository collegeRepository) { |
| 858 | + |
| 859 | + var student = template.save(new Student("S1")); |
| 860 | + var college = template.save(new College("C1")); |
| 861 | + |
| 862 | + var pair = Map.of("stuGuid", student.getGuid(), "collegeGuid", college.getGuid()); |
| 863 | + var listOfPairs = List.of(Values.value(pair)); |
| 864 | + |
| 865 | + var uuids = collegeRepository.addStudentToCollegeWorkaround(listOfPairs); |
| 866 | + assertThat(uuids).containsExactly(student.getGuid()); |
| 867 | + } |
| 868 | + |
837 | 869 | @Configuration
|
838 | 870 | @EnableTransactionManagement
|
839 | 871 | @EnableNeo4jRepositories(namedQueriesLocation = "more-custom-queries.properties")
|
|
0 commit comments