From: Keats <ke...@xa...> - 2004-03-04 17:22:44
|
WMServlet has a method called destroyContext() that was created for exactly this kind of thing. Just override the method and do any cleanup that you need to happen after the request is handled, like: public void destroyContext (WebContext wc) { hibernateSession.close(); } This will get called by the doRequest() method after the handle() method finishes. Hope this helps. Keats ----- Original Message ----- From: "c k" <woo...@ho...> To: <web...@li...> Sent: Wednesday, March 03, 2004 7:29 PM Subject: [WebMacro-user] Lazy loading when using Webmacro with Hibernate > I create servlets which extend WMServlet. In the handle() method, I put > POJOs fetched from Hibenate session into Webmacro context and just return > to let Webmacro render the page. But it reports "lazy loading problem, > session closed". So how can I close the Hibernate session after the whole > page has been rendered, override certain method in WMServlet or some other > way around? I just don't know where to put Hibernate's session.close() to > prevent lazy loading problems. > > Any help is appreciated. > > Jim Lee > > _________________________________________________________________ > 免费下载 MSN Explorer: http://explorer.msn.com/lccn/ > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Webmacro-user mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webmacro-user > |