After a long hiatus from web development, I have a chance to get back into Tapestry for a small project. I kind of need a refresher for an approach I haven't had to do before:
Context note: Running T5.3 on Tomcat or Jetty, from latest Tynamo release with Tynamo hibernate/resteasy modules. Application: I'm adapting/restructuring an existing application where I have an in memory, RO cache of several GB in a singleton object. Requests hit this cache for some things, and my plan is to have my tapestry pages and rest services bounce against that. A call to the custom cache from a page/rest service will take a session in case it needs to forward the request to databases, etc. Access from rest services/pages are not a problem because I can just inject a session and pass it to the cache. It's a requirement that this cache be in memory. Problem: I want to initialize this cache on server startup, before any pages are served, since it can take a few minutes. I want to pass it session from tapestry hibernate, since I use that configuration in the pages (I'm guessing there is some way to get an instance of HibernateSessionSource) I'm sure I could brute force a way to load it's own HibernateSessionManager and then read stuff into memory, but I wanted to see if I could @injectservice somehow. The objects being stored in memory are not necessarily hibernate objects, but we want to use hibernate to construct the caches. Once the in memory cache is created, the session it used to communicate with the DB is no longer needed. Looking around online, it seems that what I want is closest to a service and something like a DAO+Cache. Again, the DAO part is understandable, but is there a proper way to get a Hibernate session injected into it at startup so it can be built, without having to access any web resource to kick it off? Thanks