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 listAll();
}