java - Custom query in Spring Data Neo4j not retrieving relationships -


so few complex operations, using custom cypher queries using @query annotation on custom finder methods in graph repositories. however, while retrieves node, not retrieve direct relationships (i.e. 1 level).

@query("match (node:t) return node order node.requestedat desc limit 100") list<t> last100t();  @query("match (node:t) node.status = \"requested\" ,  timestamp() - node.requestedat >= 60000 return node") list<transit> findunmatchedandexpiredt(); 

i using them - (code in groovy):

 def nodes = trepository.findunmatchedandexpiredt()     nodes.foreach({         node ->             node.status = tstatus.declined             node.neighboura.status = neighbourastatus.barred             def neighbourbqueue = client.queue(node.neighbourb.username)             neighbourbqueue.push(mapper.writevalueasstring(node))      trepository.save(node) }) 

they related so:

    @nodeentity class t{      public t(){     }      @graphid     long id      @relationship(type = "requested_by", direction = relationship.outgoing)     neighbourb neighbourb      @relationship(type = "serviced_by", direction = relationship.outgoing)     neighboura neighboura } 

both neighbours , b null when relationships exist. do? i'm using spring boot 1.2.7.release spring-data-neo4j:4.0.0.release

custom queries (@query) not support depth parameter , map query returns. if you're returning single node, it'll map single node. query not modified @ runtime include relationships.

you can return node id instead , load default depth (1), or custom depth.

in future release, sdn 4 able map multiple entities returned in custom queries domain entities.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -