On 01.09.10 08:19, Szűcs Attila wrote:
> 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?

In case this is still of interest, I suggest to derive from VelocityPage
and override doPostBuild(). Don't forget to call super() in the end as
it handles recycling of the context and all pull tools.

Then in TR.p, replace

services.VelocityService.default.page = VelocityPage

with your class.

Bye, Thomas.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to