2

Using a spring-data-neo4j repository, can I use a @Query and load nodes with a depth greater than 1?

My example is

@Query("match (m:NodeTypeA)-[r:REL1]-(n:NodeTypeB {nodeBUniqueProperty: {0}}) return m")
    public NodeTypeA findByNodeBUniqueProperty(String uniqueProperty);

Using this query, NodeTypeA is returned. However I also want NodeTypeA's neighbours.

I can @Inject the ogm session and use that to get the results I want, however it would be nicer to do it with @Query.

I notice there is a note in the docs to say:

In the current version, derived finders do not support paging, sorting or a custom depth

but is a method using @Query a derived finder?

John Deverall
  • 5,954
  • 3
  • 27
  • 37

1 Answers1

2

The same applies to @Query. Using the Session methods (with Filters if required) would be the way to go at the moment.

Luanne
  • 19,145
  • 1
  • 39
  • 51