neo4j:用户定义的过程异常“不允许对“读"事务进行写操作". [英] neo4j: user defined procedure exception "Write operations are not allowed for `READ` transactions"

查看:235
本文介绍了neo4j:用户定义的过程异常“不允许对“读"事务进行写操作".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用示例模板实现了用户定义的过程. /p>

尽管使用"@Procedure(value ="foo.bar",mode = Mode.WRITE)"对过程进行了注释,但是当我尝试在修改图的Node实例上执行操作时,操作失败并显示为"READ事务不允许进行写操作."

该节点实例是通过 db.findNode (...)获得的,而我尝试执行的写操作是 nodeinstance.createRelationshipTo (.. )

有趣的是,该代码在neo4j测试工具的上下文中运行时可以正常工作.

任何帮助都将不胜感激!

解决方案

通过检查APOC用户定义的过程,我了解了答案.我正在使用neo4j 3.0.7,对于3.0.x,要写入图形的过程必须使用"@PerformsWrites"和"@Procedure"进行注释.模式参数"mode = Mode.WRITE"用于3.1,"@ PerformsWrites"用于3.0.x –从Stefan Armbruster那里学到了

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!

解决方案

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

这篇关于neo4j:用户定义的过程异常“不允许对“读"事务进行写操作".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆