Issue
I will be implementing a feature to update an id in a table after Hibernate does my deletes. But I want to get some feedback on which approach is better. Also the table I am updating the value in, Hibernate doesn't know about it so I would have to do a straight jdbc update -- is that even possible.
Solution
As far as using listener / interceptor goes, I'd go with listener - it's more flexible in terms of events that can be listened to. Interceptor's primary purpose is to inspect / alter object properties prior to some event (e.g. deletion); whereas listener can be configured to listen to "PostDelete" event or many others.
However, if said table is not mapped why do you need either? You can instead update it directly in your code after you've called delete() (or after you've called flush() if there's a foreign key involved).
You can also do that in a trigger (possibly; depending on whether necessary information is available in the database, of course).
Answered By - ChssPly76