I have an EJB app. which basically has to execute a SQL query when it is shutdown. A shutdown hook would presumably work, but that way I can’t use injected entitymanager/datasource etc.
Is there a way to provide a shutdown hook that can invoke methods on EJB bean?
Our EJB container is JBoss5.1.
Thanks!
It looks like this works:
(EDIT: For some reason the previously posted answer did not work with JBoss5.1. This works.)