Closed voidstardb closed 9 years ago
Unfortunately, this is how Neo4j works today - if you create a node a return it immediately, its contents do not reflect changes performed by transaction event handlers (i.e., it does not re-read the node before returning it). This is true for all the APIs, the browser, etc. A separate call must be made to get the UUID and I don't think there's any way we can change this behaviour in the framework.
Thanks for the explanation.
Just for future reference: http://neo4j.com/docs/2.2.1/javadocs/org/neo4j/graphdb/event/TransactionEventHandler.html
beforeCommit The transaction is still open when this method is invoked, making it possible to perform mutating operations in this method. This is however highly discouraged. Changes made in this method are not guaranteed to be visible by this or other TransactionEventHandlers.
There's no other obvious lifecycle hook in which to place the UUID functionality. So, I guess we're stuck with this for now.
What a shame...
Is there something new about this?
But, it is NICE TO HAVE feature though. Can i get the below doubt cleared please?
With graphaware framework and neo4j-uuid plugins installed:
create (n {name: "foo"}) return n, n.uuid;
match (n {name: "foo"}) return n, n.uuid;
Actual result:
{name: "foo"}, null
(from create){name: "foo", uuid: "<UUID>"}, <UUID>
(from match)Expected result:
{name: "foo", uuid: "<UUID>"}, <UUID>
{name: "foo", uuid: "<UUID>"}, <UUID>
This issue is reproducible via neo's REST API as well. Not returning the UUID at time of create requires additional cypher queries to get the UUID.