spring-guides / gs-accessing-data-neo4j

Accessing Data with Neo4j :: Learn how to persist objects and relationships in Neo4j's NoSQL data store.
http://spring.io/guides/gs/accessing-data-neo4j/
Apache License 2.0
29 stars 49 forks source link

guiding text is not inline with code fragments and application returns different values #39

Open hannesgeodan opened 3 years ago

hannesgeodan commented 3 years ago

A few remaks about text surrounding the code:

Lookup each person by name... Greg's teammates => [Roy, Craig] Roy's teammates => [Greg, Craig] Craig's teammates => [Roy, Greg]

to 

Before linking up with Neo4j... Greg's teammates => [] Roy's teammates => [] Craig's teammates => [] Lookup each person by name... Greg's teammates => [Roy, Craig] Roy's teammates => [Craig] Craig's teammates => [] The following have Greg as a teammate... Closing driver instance 61814127


- for this new directionality also the comment `// We already know craig works with roy and greg` is incorrect.
runan520 commented 2 years ago

me too!

runan520 commented 2 years ago

List teammates = personRepository.findByTeammatesName(greg.getName()); log.info("The following have Greg as a teammate..."); Is there no data available in this place?

LiberiFatali commented 2 years ago

I have done this. There are changes in Spring Data Neo4j here: https://stackoverflow.com/questions/68472313/spring-data-neo4j-6-relationship-undirected

So the code needs to be updated as following:


            greg = personRepository.findByName(greg.getName());
            greg.worksWith(roy);
            greg.worksWith(craig);
            personRepository.save(greg);

            roy = personRepository.findByName(roy.getName());
            roy.worksWith(craig);
            // We already know that roy works with greg
            roy.worksWith(greg);
            personRepository.save(roy);

            // We already know craig works with roy and greg
            craig = personRepository.findByName(craig.getName());
            craig.worksWith(roy);
            craig.worksWith(greg);
            personRepository.save(craig);
Buzzardo commented 1 year ago

Since the solution is in the issue thread, I'm going to mark this one as a good first issue, to encourage someone in the community to try their hand at an OSS contribution.