I have this type of graph on a Neo4J DB:
(Child)-[has_parent]->(Parent)-[has_parent]->(Parent)-[has_parent]->(Parent)
I have a java application using spring data to connect to Neo4J and I am trying to get a query to return Child node with full parent hierarchy.
I have @NodeEntity classes for both Child and Parent, and they are related using a @RelationshipEntity class.
Using query:
@Query("MATCH(c:Child-[r:has_parent]->(p:Parent) return c,r,p")
Return the Child with first parent only. I have tried using @Depth annotation with values >2, but it does not work.
What query do I need to get full hierarchy in this case?