Quantcast
Channel: Spring Community Forums - NoSQL
Viewing all articles
Browse latest Browse all 128

Neo4jTemplate query method does not seem to return the same result as native api

$
0
0
Using Spring Data I've written the code below using the Neo4jTemplate:

Code:

Result<Map<String, Object>> result = neo4jTemplate.query(
    "START n = node:`n.name`(name = \"name\") MATCH (n)-[c:CONNECTS]->(x) RETURN x ORDER BY c.`order`",
    new HashMap<String, Object>()
);

When I execute this code I get no results. After verifying that my query works correctly using the Neo4j web console, I rewrote my Spring Data code using the native Neo4j API:

Code:

ExecutionEngine executionEngine = new ExecutionEngine(graphDatabaseService, StringLogger.SYSTEM);

ExecutionResult queryResult = executionEngine.execute(
    "START n = node:`n.name`(name = \"name\") MATCH (n)-[c:CONNECTS]->(x) RETURN x ORDER BY c.`order`"
);

When executing this code I do receive the correct amount of items from the query. Am I doing something wrong here when working with the Neo4jTemplate or is there no support for this type of query built-in in the Neo4jTemplate?

I am having the exact same problem when annotating a field using @Query and setting the value of this annotation to the query I wrote in the previous code fragment.

Viewing all articles
Browse latest Browse all 128

Trending Articles