I am using spring-data-neo4j v4.2.8.
I have a NodeEntity with 2 EntityRelationship one is for incoming the other is for outgoing.
I want to load the nodes with a specific filter using the repository @Query method. All relationship should be loaded with the node. This is my query
@Query(value = "MATCH (n:`Person`) WHERE {0} IN labels(n) RETURN n")
Iterable<Person> findAllByLabels(String label);
=> I am loading nodes with two labels Person and a specific label.
I have tried many things:
- using @depth in the method
specifying the relationship in the query like this.
@Query(value = "MATCH (n:`Person`)<-[r]-() WHERE {0} IN labels(n) RETURN n") Iterable<Person> findAllByLabels(String label);In this case only the nodes with relationship are loaded and there is other problems with it.
What alternative do I have to make this work.
Thank you.
This is the solution that I have found so far