Identity of impacted nodes/relationships following a write query

(Eric) #1

I am using neo4j java client. When a write query is successful, I know it is possible to know how many nodes have been created, updated or deleted, and same for relationships via SummaryCounters. However, is there a way to know exactly which nodes and relationships have been created/updated/deleted ?


(Stefan Armbruster) #2

You could use a serverside TransactionEventHandler. In it's afterCommit method you get a callback with exactly that information.
APOC Triggers ( leverage exactly that functionality.

(Eric) #3

As far as I know, TransactionEventHandler is not available in neo4j-java-driver. I have to add neo4j-graph-api dependency. Is it correct ?

(Stefan Armbruster) #4

TransactionEventHandlers are a server-side concept - so that code should be a separate module from your client -side part.

See for an example.