Hi Martin I'm not using spring, not sure if I should be. I recently tried writing an app using Hibernate and had some great experiences - it's pretty cool in the amount of code and development time it saves me.
Having said that I'm struggling with the same problem. I open the Hibernate session in my Action class, update / access the data and then close the session. I get the "session is closed" when the page begins to render properties from my bean (where those properties originated from related tables). Reading through the Hibernate manual it indicated that by specifying fetch="join" the related table would be retrieved in the same select statement. I tried this but got the same "session is closed" result. It also said that you could specify lazy="false" and it would retrieve everything at once, however it immediately recommends you don't do this for lots of good reasons (I did try some but they didn't seem to work, maybe I put them in the wrong place). How does the filter modify this process for you? It doesn't sound like it has solved the problem. Kind regards mc On 30 Sep 2005 at 10:30, Martin Ravell wrote: > I'm just getting back to looking at my lazy loading problem and would like > to see if I am understanding things correctly. While not strictly Struts > related (I do use Struts in this app) I am hoping that someone else on this > list has gone down the same path as I am attempting. > > My web.xml has the following section in it: > > <filter> > <filter-name>hibernateFilter</filter-name> > > <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFi > lter</filter-class> > </filter> > > <filter-mapping> > <filter-name>hibernateFilter</filter-name> > <url-pattern>*.spring</url-pattern> > </filter-mapping> > > > I have also tried other patterns than *.spring (as I was unsure if this was > correct. > > When attempting to access objects in the jsp that have come from hibernate I > am still getting : > > [LazyInitializationException] could not initialize prozy - the owning > Session was closed................ > > Originally I was using Hibernate 2 and had tried the similar > OpenSessionInViewFilter that is meant for that version. Same problem. > > Any ideas? > > Am I correct in thinking that if the filter is working correctly I should be > able to grab an object from my DAO layer in an Action, put it into the > session or request scope and have my jsp page access it's related objects > (with lazy loading)? > > What mechanism opens and closes these Hibernate sessions? I thought it was > supposed to be all done by the filter? > > PS. I do use Tiles with my Struts if this makes any difference. > > > > Regards > Marty > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.344 / Virus Database: 267.11.9/115 - Release Date: 29/09/2005 > FOCUS Computing Mob: 0415 24 26 24 [EMAIL PROTECTED] http://www.focus-computing.com.au -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.9/115 - Release Date: 29/09/2005 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]