cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cannot get all related values from Neo4j in Spring Boot.

I have a problem with getting all values from the database. My entities are City and its route. When I call the listAll function, I get an empty list even if there are some values in the database.

How can I fix my issue?

Here are my entities as City and Route showed below.

City

public class City {

    @Id
    @Property
    private UUID id;

    @Property
    private String name;

    @Relationship(type = "ROUTES", direction = Relationship.Direction.OUTGOING)
    private Set<Route> routes = new HashSet<>();

    public City(String name) {
        this.name = name;
    }
}

Route

public class Route {

    @Id
    @Property
    private UUID id;

    @Property
    private String from;

    @Property
    private String destination;

    @Property
    private String departureTime;

    @Property
    private String arriveTime;

    @Property
    private Long duration;
}

Here is my CityRepository shown below.

public interface CityRepository extends Neo4jRepository<City,UUID> {
    @Query("MATCH (city:City)-[r:ROUTES]->(route:Route) RETURN city, collect(r), collect(route)")
    List<City> listAll();
}

 

 

 

0 REPLIES 0
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online