neo4j-uuid icon indicating copy to clipboard operation
neo4j-uuid copied to clipboard

How to let the user know of the added uuid in a given txn

Open ramukima opened this issue 10 years ago • 1 comments

I understand that the 'uuid' is added as part of beforeCommit transaction as a property on nodes/edges added within a given transaction. What I do not understand is, how do I expose the newly added 'uuid' to the caller after the transaction is over ?

Say for example my function does these four steps -

  1. Create a new transaction
  2. Add a vertex
  3. Commit transaction
  4. Return details of the vertex added as JSON.

I have exposed my function as an API to a caller. After step 4, I expect the newly added uuid to be returned to the caller. Will it automatically be available during vertex to JSON serialization in step 4 or I have to fetch the vertex again to know the value of 'implicitly' added 'uuid' ?

ramukima avatar Jun 12 '14 06:06 ramukima

There seems to be a known issue that changes done by TransactionEventHandlers are not visible in the result of the same transaction. Workaround is to query the node by its id afterwards in a separate transaction - this one should contain the uuid. Being in progress for updating neo4j-uuid for current releases of Neo4j.

sarmbruster avatar Jun 14 '14 19:06 sarmbruster