Reputation: 3320
I am not able to get data from neo4j server
using the spring data annotated query, though data exists in the server, also if i use the same query and paste it in neo4j console
it works well and returns me the below data:
----------------------------------------------------------------------------+
| n |
+---------------------------------------------------------------------------+
| Node[25503]{id:1388107845,name:"Cricket",__type__:"com.domain.Sport"} |
+---------------------------------------------------------------------------+
The anotated spring data query is
@Query("match n where n.__type__='com.domain.Sport' and n.name='{0}' return n;")
public Sport getSportWithName(String sportName);
Any insights on what is wrong with this query.
Upvotes: 0
Views: 121
Reputation: 41676
Don't quote parameters:
@Query("match n where n.__type__='com.domain.Sport' and n.name={0} return n")
public Sport getSportWithName(String sportName);
Upvotes: 2
Reputation: 314
Are you using @TypeAlias on com.domain.Sport?
If so, try using the alias value in the query:
@Query("match n where n.__type__='Sport' and n.name='{0}' return n;")
public Sport getSportWithName(String sportName);
Upvotes: 0