@@ -155,6 +155,12 @@ interface MovieRepository extends Neo4jRepository<Movie, String> {
155
155
156
156
@ Query ("MATCH (m:Movie{title:'The Matrix'})<-[a:ACTED_IN]-(p:Person) WITH a,p,m order by p.name DESC return m, collect(a), collect(p)" )
157
157
Movie findMatrixWithSortedDescActors ();
158
+
159
+ @ Query ("MATCH p=(:Movie{title:'The Matrix'}) return p" )
160
+ Movie findSingleNodeWithPath ();
161
+
162
+ @ Query ("MATCH p=(m:Movie{title:'The Matrix'})<-[:ACTED_IN]-(:Person) return m, collect(nodes(p)), collect(relationships(p))" )
163
+ List <Movie > findMultipleSameTypeRelationshipsWithPath ();
158
164
}
159
165
160
166
@ Test // GH-1906
@@ -469,13 +475,27 @@ void findPreservesOrderFromResultAscInRelationshipList(@Autowired MovieRepositor
469
475
.containsExactly ("Carrie-Anne Moss" , "Emil Eifrem" , "Gloria Foster" , "Hugo Weaving" , "Keanu Reeves" ,
470
476
"Laurence Fishburne" );
471
477
}
478
+
472
479
@ Test // GH-2458
473
480
void findPreservesOrderFromResultDescInRelationshipList (@ Autowired MovieRepository repository ) {
474
481
assertThat (repository .findMatrixWithSortedDescActors ().getActors ()).extracting ("person" ).extracting ("name" )
475
482
.containsExactly ("Laurence Fishburne" , "Keanu Reeves" , "Hugo Weaving" , "Gloria Foster" , "Emil Eifrem" ,
476
483
"Carrie-Anne Moss" );
477
484
}
478
485
486
+
487
+ @ Test // GH-2470
488
+ void mapPathWithSingleNode (@ Autowired MovieRepository repository ) {
489
+ assertThat (repository .findSingleNodeWithPath ()).isNotNull ();
490
+ }
491
+
492
+ @ Test // GH-2473
493
+ void mapPathWithMultipleSameTypeRelationships (@ Autowired MovieRepository repository ) {
494
+ List <Movie > movies = repository .findMultipleSameTypeRelationshipsWithPath ();
495
+ assertThat (movies ).hasSize (1 );
496
+ assertThat (movies .get (0 ).getActors ()).hasSize (6 );
497
+ }
498
+
479
499
@ Configuration
480
500
@ EnableTransactionManagement
481
501
@ EnableNeo4jRepositories (considerNestedRepositories = true )
0 commit comments