Hi
This might be a silly question, but where or how would one call the close() methods on the SessionFactory existing in a web application?
The SessionFactory gets created when the app starts up (not placing it in JNDI...), and the API docs state:
Quote:
Destroy this SessionFactory and release all resources (caches, connection pools, etc)
But from a webapp - how would you know when the application server is shutting down, or if you application is being stopped?
I've tried
Code:
Runtime.getRuntime().addShutdownHook(new Thread() { ... });
, but that didn't seem to work... (stopping Tomcat from inside Eclipse, stopping application from Tomcat manager (outside eclipse), or stopping Tomcat (outside eclipse)).
Placing that ShutdownHook in a standalone Java app does work...
There must be a common solution for this?
Any suggestions?
Thanks[/code]