I am trying to select a path with locking the last node in that path using Java OGM for Neo4j.
To do that in cypher I have written the following query:
String q = "Match path = (p:Root) - [*1..100]-(m:Leaf) WHERE m.State = 'Non-Processed' WITH m,p,path ORDER BY length(path) Limit 1 SET m.State = 'Processing' RETURN path"
It selects the necessary path with locking the last leaf(by changing its State
property).
However, when I try to execute this query:
session.query(Path.class, q, propertyMap)
I get a java.lang.RuntimeException: query() only allows read only cypher. To make modifications use execute()
What is the proper way to do this?