问题
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