Neo4j:GraphDatabaseService.registerTransactionEventHandler()似乎不起作用 [英] Neo4j: GraphDatabaseService.registerTransactionEventHandler() does not seem to work
问题描述
关于我之前的问题:
我对GraphDatabaseService.registerTransactionEventHandler()
有问题.当我尝试运行此处理程序,在运行1.9.2时,我不会收到对beforeCommit
方法的任何调用,对于2.0.0-M03的新数据库,只有一次即使已创建一个节点,TransactionData.createdNodes()
也会返回一个空的迭代器.由于这些原因,测试失败并显示org.neo4j.kernel.api.exceptions.PropertyKeyNotFoundException: Property key 'uuid' not found
.
I have a problem with GraphDatabaseService.registerTransactionEventHandler()
. When I try to run this test against this handler, I don't get any calls to the beforeCommit
method when running 1.9.2 and only once for a new database for 2.0.0-M03, and for that TransactionData.createdNodes()
returns an empty iterator even though a a node has been created. The test fails with org.neo4j.kernel.api.exceptions.PropertyKeyNotFoundException: Property key 'uuid' not found
for these reasons.
我做错什么了吗,还是registerTransactionEventHandler中有错误?
Am I doing something wrong, or is there a bug in registerTransactionEventHandler?
推荐答案
在 http://docs. neo4j.org/chunked/stable/transactions-interaction.html .
You're lacking tx.finish()
on the first transaction just after https://github.com/ttiurani/neo4j-uuid/blob/master/src/test/java/org/neo4j/extension/uuid/UUIDTransactionEventHandlerTest.java#L2. Therefore the transaction is not committed and the TransactionEventHandler not called, see http://docs.neo4j.org/chunked/stable/transactions-interaction.html.
这篇关于Neo4j:GraphDatabaseService.registerTransactionEventHandler()似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!