The most common way to solve this problem is to use the Open Session
In View pattern, which leaves the Hibernate session open until the JSP
has finished rendering.  Typically accomplished with a filter, there
is also a Struts plugin to help with this pattern.

Google for "Open Session In View" and you'll find a handful of solutions.

On 8/9/05, Konrad Billewicz <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I am using Hibernate in my Struts project. A have a problem with Hibernate 
> lazy
> option. When I am setting it to true, I get an error in my JSPs:
> 
> org.apache.jasper.JasperException: could not initialize proxy - the owning
> Session was closed
> 
> Of course I know why this error occurs. I am closing the session at the end of
> each action - before JSPs processing. My question is how clever solve this
> problem? lazy="false" is not acceptable because I have a table with so many
> joins that database is going down.
> 
> My only idea is to include a bean and run sessionClose() method at the end of
> each JSP... but it is a very dirty method. :-( As far as I know, there is no
> method to run any code "at the end" of Struts execution.
> 
> If you have any ideas or solutions I would be very gratefull.
> 
> Best regards,
> Konrad Billewicz
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to