Announcement Announcement Module
Collapse
No announcement yet.
Cypher query in a @Query annotated method is not invoked?! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cypher query in a @Query annotated method is not invoked?!

    Hi,

    As discussed in previous related thread (http://forum.springsource.org/showth...notated-method)
    I have the following @NodeEntity annotated POJO. Its getRelationshipsByType() method always returns empty results despite the fact that there are actually relationships matching the query in the graph db.

    @NodeEntity
    public class POJO
    {
    ....
    private Iterable<POJO> relatedByType;

    @Query(value="START n=node({self}) MATCH n-[rel]->relN WHERE type(rel)={relType} RETURN relN")
    public Iterable<POJO> getRelationshipsByType(@Param("relType") String type)
    {
    return relatedByType;
    }
    ...
    }

    It looks that the query is not executed at all as I tried putting an obviously invalid query like the following and method still returns empty result without any exceptions:

    @Query(value="THIS IS AN INVALID QUERY!!! START n=node({self}) MATCH n-[rel]->relN WHERE type(rel)={relType} RETURN relN")

    Even checked for annotation name clash - the annotation is of correct type org.springframework.data.neo4j.annotation.Query

    What I am doing wrong?

    Thank you in advance for any help!

  • #2
    hsherlock,

    Might it be a Spring wiring issue?

    Could you share a small test project that reproduces the issue?

    Because you are right, this should work (i.e. fail), and does work for other users.

    Lasse

    Comment

    Working...
    X