sarmbruster / neo4j-uuid

Neo4j-uuid is a unmanaged extension to Neo4j. It features automatic UUIDs on nodes and relationships.
GNU General Public License v3.0
25 stars 11 forks source link

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

Open ramukima opened 10 years ago

ramukima commented 10 years ago

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' ?

sarmbruster commented 10 years ago

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.