Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Tom van Dijk
What if you do this: public class DbShutdownImpl implements DbShutdown, RegistryShutdownListener { @Inject private HibernateSessionSource sessionSource; private final static Logger LOG = Logger.getLogger(DbShutdownImpl.class); @PostInjection public void

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Javier Molina
Subclass TapestryFilter, map your class instead of Tapestry's in web.xml and override destroy(Registry registry). There you can use something like: DbShutdown dbShutdown = registry.getService(DbShutdown.class); // add this new method and close the database there dbShutdown.shutdownDatabase();

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Paul Stanton
same error, different service which can't be injected. On 29/11/2010 8:13 PM, Tom van Dijk wrote: What if you do this: public class DbShutdownImpl implements DbShutdown, RegistryShutdownListener { @Inject private HibernateSessionSource sessionSource; private final static Logger

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Paul Stanton
Thanks Javier, this sounds like it would work, but then it also doesn't sound very 'tapestry-ish' and if it's the only way to achieve this, shows a bit of a hole in the tapestry/tapestry-ioc implementation... is there a better solution? On 29/11/2010 8:17 PM, Javier Molina wrote: Subclass

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Thiago H. de Paula Figueiredo
On Mon, 29 Nov 2010 03:28:09 -0200, Paul Stanton p...@mapshed.com.au wrote: Hi all, Hi! I'm using tapestry-hibernate and an embedded HSQLDB database. Another suggestion: why don't you use a non-embedded HSQLDB database while developing? That's what I do when I use HSQLDB. Or launch a

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Paul Stanton
thanks thiago, that would work too... however if using a embedded hsqldb in production the same problem would occur... in order to solve my case, it's probably simpler to just create a new jdbc connection for shutdown (without hibernate support). however i'm intrigued that there's no ability

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Tom van Dijk
Which service would that be? Could you provide a stack trace? Perhaps you could make your service contribute to RegistryStartup as well, to make sure the DbShutdownImpl service is realized and that the sessionSource is realized. The startupService would then be the registry startup method. I

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Javier Molina
Overriding the filter might look ugly, but it was designed for that; see the comments on destroy() and destroy(Registry registry). You might find it less ugly to have a ServletContextListener and do the cleanup in contextDestroyed. The real solution would be to have a

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Tom van Dijk
Well, designed or not, I suppose overriding the filter is not a modular solution. You can't add a third party library and expect it to work, instead the application developer needs to do additional work by modifying web.xml and on top of that, if you use your service without tapestry-core, it

Re: tapestry-hibernate, hsqldb and registry shutdown

2010-11-29 Thread Paul Stanton
Javier, I agree re registryIsShuttingDown .. that is what i'm looking for. something that is called after new httprequests have been stopped, but before the registry becomes broken. there would need to be some ordered configuration to control the process however. i'm guessing this doesn't

tapestry-hibernate, hsqldb and registry shutdown

2010-11-28 Thread Paul Stanton
Hi all, I'm using tapestry-hibernate and an embedded HSQLDB database. As you might know, it's important to tell HSQLDB to shutdown when you are terminating the vm. You do this by executing a proprietary SQL query SHUTDOWN before closing your last connection. Ideally I'd like to use