On Thu, Aug 9, 2012 at 10:17 AM, Daniel Jue <teamp...@gmail.com> wrote: > Thanks Kalle, that was the example I wanted to see. Is there a way to > force my tapestry-hibernate module to load before my CacheModule , so I can > grab it's configuration? Right now I'm spinning up a separate hibernate > configuration, and then manually loading classes into that configuration.
Just inject whatever services you need, Tapestry will take care of the rest. It's not a question of loading modules but in which order the services are realized. Kalle > On Thu, Aug 9, 2012 at 1:05 AM, Kalle Korhonen > <kalle.o.korho...@gmail.com>wrote: > >> 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 >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org