On Wed, Aug 8, 2012 at 9:46 PM, Daniel Jue <teamp...@gmail.com> wrote: > 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?
Yes, create your service (or create a helper service) to start with @EagerLoad. Lots of things use this but for an example, you could take a look at SeedEntityImpl, an implementation class in Tynamo's seedentity module (http://tynamo.org/tapestry-hibernate-seedentity+guide). Kalle --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org