turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Glass-Husain <wglasshus...@gmail.com>
Subject Re: Template execution finished listener
Date Wed, 01 Sep 2010 12:32:22 GMT
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 <szucs.attila@codespring.ro>

> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message