You may also find useful this article
http://www.hibernate.org/43.html - or just google for "Open Session in View" :)

HTH, Sergey


David Delbecq wrote:
See sections
20.1.4. Initializing collections and proxies and 1.4, “Playing with cats”
For details :) (Hibernate 3 documentation)
Martin Ravell a écrit :


Hi David,

This sounds good but I should have mentioned that I am somewhat new to this
particular area and as a result I have no idea how to go about doing what
you have suggested.

I will continue to research but would you be able to help me with a little
more detail on what this entails?


Regards
Marty

-----Original Message-----
From: David Delbecq [mailto:[EMAIL PROTECTED] Sent: Tuesday, 20 September 2005 10:04 PM
To: Struts Users Mailing List
Subject: Re: Being Lazy with Hibernate

For lazy initialization to work, at the moment of the lazy initialisation,
(that is the moment you request the data) the hibernate session must
not be closed.
The best way to do this is to store the hibernate session in the user
session and use a servlet filter to connect/disconnect/reconnect the
hibernate
session.

Martin Ravell a écrit :




Has anyone been able to get a Struts / Hibernate app to work nicely with
Lazy Initialization?

Whenever I have things with Lazy set to true I'm getting a "Failed to

lazily



initialize a collection" Exception.

I'd like to be able to lazily access related objects in my DAO layer,
potentially my Actions and the JSPs of the frontend as well. (I use tiles

as



well if that affects things).

Is this possible? I've posted once or twice to the Equinox list but it

seems



a little low on traffic these days and was wondering if anyone else out
there has done this particular thing with the same combination of
technologies?

If it is at all relevant my app is using Hibernate 2, JBoss 3.2.1 with a
Tomcat 4 plugin (not my choice and I cannot change it), an Apache web

server



and Oracle as the DB.

If there is anyone out there being successfully lazy I'd love to hear from
you. I've been trying filters and such things but without result so far.



Regards
Marty






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



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



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

Reply via email to