Neo4j: GraphDatabaseService.registerTransactionEventHandler() does not seem to work

牧云@^-^@ 提交于 2020-01-16 07:25:13

问题


Regarding my previous question:

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.

Am I doing something wrong, or is there a bug in registerTransactionEventHandler?


回答1:


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.



来源:https://stackoverflow.com/questions/18101964/neo4j-graphdatabaseservice-registertransactioneventhandler-does-not-seem-to-w

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