@@ -969,7 +969,7 @@ void findEntityWithSelfReferencesInBothDirections(@Autowired PetRepository repos
969
969
Pet loadedPet = repository .findById (petId ).get ();
970
970
971
971
assertThat (loadedPet .getFriends ().get (0 ).getName ()).isEqualTo ("Daphne" );
972
- assertThat (loadedPet .getFriends ().get (0 ).getFriends ().get (0 ).getName ()).isEqualTo ("Luna " );
972
+ assertThat (loadedPet .getFriends ().get (0 ).getFriends ().get (0 ).getName ()).isEqualTo ("Tom " );
973
973
974
974
}
975
975
@@ -979,6 +979,12 @@ void countByPropertyWithPossibleCircles(@Autowired PetRepository repository) {
979
979
assertThat (repository .countByName ("Luna" )).isEqualTo (1L );
980
980
}
981
981
982
+ @ Test // GH-2157
983
+ void countByPatternPathProperties (@ Autowired PetRepository repository ) {
984
+ createFriendlyPets ();
985
+ assertThat (repository .countByFriendsNameAndFriendsFriendsName ("Daphne" , "Tom" )).isEqualTo (1L );
986
+ }
987
+
982
988
@ Test // GH-2157
983
989
void countByCustomQueryShouldWork (@ Autowired PetRepository repository ) {
984
990
createFriendlyPets ();
@@ -994,7 +1000,7 @@ void existsByPropertyWithPossibleCircles(@Autowired PetRepository repository) {
994
1000
private long createFriendlyPets () {
995
1001
try (Session session = createSession ()) {
996
1002
return session .run ("CREATE (luna:Pet{name:'Luna'})-[:Has]->(daphne:Pet{name:'Daphne'})"
997
- + "-[:Has]->(luna )" + "RETURN id(luna) as id" ).single ().get ("id" ).asLong ();
1003
+ + "-[:Has]->(:Pet{name:'Tom'} )" + "RETURN id(luna) as id" ).single ().get ("id" ).asLong ();
998
1004
}
999
1005
}
1000
1006
@@ -3883,6 +3889,8 @@ interface PetRepository extends Neo4jRepository<Pet, Long> {
3883
3889
@ Query (value = "RETURN size($0)" , count = true )
3884
3890
long countAllByName (String name );
3885
3891
3892
+ long countByFriendsNameAndFriendsFriendsName (String friendName , String friendFriendName );
3893
+
3886
3894
boolean existsByName (String name );
3887
3895
}
3888
3896
0 commit comments