How about a servlet filter? Open the hibernate session before the request is called, stick it in a request attribute, and close it when the request is done.
WILL 2010/9/1 Szűcs Attila <[email protected]> > Hi, > > I am using Turbine 2.3.2 with Hibernate 3. My problem is that the Hibernate > session is not active when my (Velocity 1.6.4) template executes, and I am > accessing fields from the database for which Hibernate needs lazy > initialization. Therefore I get a LazyInitializationException - no Session > error. Since I want my Hibernate session to be alive when a velocity > template executes I would like to have a class to execute after the velocity > vm. This way I could close my Hibernate session properly, only after the > velocity template has been rendered. (Disabling lazy initialization in > Hibernate is not an option for me). Are there any possibilities that Turbine > offers to write a kind of listener (I am not sure how to call it) that would > execute right after a velocity screen has been executed? > > Thanks , > Atti >
