Spring Boot JPA with Neo4j and multiple nodes
I have created a small Spring Boot Project that takes data from a local neo4j data source ( ogm ) and hopefully will return weather data from DarkSky / OpenWeather along with later collected data from my homebrew weather station,
So the setup are 3 node entities
WeatherData DarkSky OpenWeather
My Cypher query inside the WeatherDataRepository looks like this,
@Query("Match (z:Zone),(w:WeatherData),(c:Customer),(d:DarkSky),(o:OpenWeather) where c.ID_Token = $token" + " and (c)-[:Has_Subscribed_To]->(z) and (z)<-[:Weather_Data_For]-(w) return w as WeatherData, d "+ "as DarkSky, o as OpenWeather")
List weather(String token);
In the webUI the query returns the 3 nodes and relationships according to the matching of each part.
So ive tried a few things inside the controller after reading from docs.spring.io around this area but have not achieved what I am looking for so obviously doing it wrong.
my current WeatherData Controller looks like,
@NodeEntity(label = "WeatherData") public class WeatherData { private String Description; private List<DarkSky> DarkSky; private List<OpenWeather> OpenWeather; public List<DarkSky> getDarkSky() { return DarkSky; } public void setDarkSky(List<DarkSky> darkSky) { DarkSky = darkSky; } public List<OpenWeather> getOpenWeather() { return OpenWeather; } public void setOpenWeather(List<OpenWeather> openWeather) { OpenWeather = openWeather; } public String getDescription() { return Description; } public void setDescription(String description) { Description = description; }
I have autowired the repository, so with this I am getting the description from the WeatherData Node but not the DarkSky or OpenWeather Nodes. From Postman I get the following
[ { "description": "Weather Data From DarkSky And OpenWeather", "darkSky": null, "openWeather": null } ]
as you can see, any help here would be more than appreciated as I am still learning alot about the framework and methods on getting the data in I require.