neo4j: user defined procedure exception “Write operations are not allowed for `READ` transactions”

空扰寡人 提交于 2019-12-12 02:17:58

问题


I have implemented a user defined procedure using the example template.

The procedure is annotated using "@Procedure(value = "foo.bar", mode = Mode.WRITE)", nevertheless, when I try to execute an operation on a Node instance that modifies the graph, it fails with "Write operations are not allowed for READ transactions".

The node instance was obtained via db.findNode(...), and the write-operation that I am attempting to execute is nodeinstance.createRelationshipTo(...)

Interestingly, the code works fine when run in the context of the neo4j testing harness.

Any help greatly appreciated!


回答1:


From inspecting the APOC user defined procedures, I learned the answer. I am using neo4j 3.0.7, for 3.0.x a procedure that wants to write to the graph must be annotated with "@PerformsWrites", as well as "@Procedure". The mode argument", mode = Mode.WRITE", is for 3.1, and "@PerformsWrites" is for 3.0.x -- learned this from Stefan Armbruster



来源:https://stackoverflow.com/questions/42257822/neo4j-user-defined-procedure-exception-write-operations-are-not-allowed-for-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!