Use of onBeforeDelete Dynamic Hook to do something other than delete a document?


#1

Using OrientDB’s Dynamic Hooks, it’s simple to do something in response to any CRUD operation, including stopping the operation (by throwing an exception). But I’m trying to figure out how to “do something different” and still return a “successful” result to the caller. Specifically, in response to a DELETE operation, I want to instead UPDATE the target document (i.e. instead of deleting it, I’ll “mark” it as deleted, for example). I can easily accomplish this with an onBeforeDelete hook, but the missing piece of the puzzle is how to then avoid the delete operation without throwing an exception?