Context of onRecordAfterCreate() call back

21 views
Skip to first unread message

Guruprasad Nagaraj

unread,
Apr 13, 2015, 3:26:28 AM4/13/15
to orient-...@googlegroups.com
Hi,
I am using 2.0.6.

I use the following calls to create/update a record -

- Get an instance of dbTx() from OrientGraphFactory
- Create vertices or retrieve and update
- dbTx().commit()
- Finally release the tx instance using dbTx().shutdown()

I am trying to see if I can use Hooks/Triggers to automate some functionality post create or update.
My question is - Is the onRecordAfterCreate() and onRecordAfterUpdate() called within the same thread that executes the code above?
If that is the case, then any changes to the graph in the above call back methods should also be followed by a commit(). Correct?

Thanks and Best Regards,
GPN

Guruprasad Nagaraj

unread,
Apr 13, 2015, 4:30:21 AM4/13/15
to orient-...@googlegroups.com
Did a small test and the call back method is indeed called in the same context -

13:52:20,627 INFO  [DbRepo] (default task-10) [sample_db] created vertex v1 in class vertex1 
13:52:20,635 INFO  [RepoHooks] (default task-10) onRecordAfterCreate() called for sample_db, vertex1
13:52:20,639 INFO  [RepoHooks] (default task-10) onRecordAfterCreate() called for sample_db, vertex1
13:52:20,639 INFO  [RepoHooks] (default task-10) onRecordAfterCreate() called for sample_db, vertex1
13:52:20,663 INFO  [RepoHooks] (default task-10) onRecordAfterCreate() called for sample_db, vertex2
13:52:20,665 INFO  [RepoHooks] (default task-10) onRecordAfterCreate() called for sample_db, vertex2
13:52:20,665 INFO  [RepoHooks] (default task-10) onRecordAfterCreate() called for sample_db, vertex2
13:52:20,665 INFO  [DbRepo] (default task-10) [sample_db] calling dbTx().commit()
13:52:20,673 INFO  [DbRepo] (default task-10) [sample_db] calling dbTx().shutdown() 

Luca Garulli

unread,
Apr 13, 2015, 7:41:42 AM4/13/15
to orient-...@googlegroups.com
I confirm it, the thread is the same.

Lvc@


--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best Regards,

Luca Garulli
CEO at Orient Technologies LTD
the Company behind OrientDB

Reply all
Reply to author
Forward
0 new messages