You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Thomas Vandahl <tv...@apache.org> on 2011/01/27 22:14:19 UTC

Re: Template execution finished listener

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: user-unsubscribe@turbine.apache.org
For additional commands, e-mail: user-help@turbine.apache.org