The technique we use in the book takes advantage of the IoC container and a Hibernate Session saved at request-scope. This is essentially the same thing as a filter (afterall, a filter is what controls the request-scoped objected in XWork's IoC).
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jon Mountjoy Sent: Sunday, October 26, 2003 1:31 AM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Hibernate with interceptor Hi Matt and others, > The main issue with using an interceptor is handling chaining. <snip> > ... open MyAction session ... > ... invoke MyAction ... > ... open ChainedAction session ... > ... invoke ChainedAction ... > ... close ChainedAction session ... > ... close MyAction Session ... > > this probably isn't what you want :) I don't see the problem with this. It all depends on how you implement "open session" and "close session". The Hibernate documentation describes a variation of the "open session in thread" which has a counter. Opening a session, in which it is not associated with a thread, will actually open it. Otherwise, it will merely increment a counter. Likewise, closing will decrement the counter unless at zero, at which time it will actually close it. Using this technique, you can chain all you like and you will still be guaranteed a single session. (IMO) The only problem I see with Hibernate + WW2 is that WW2 doesn't seem to allow you to wrap an intereceptor around an action. What you get with intereceptors in WW2 (correct me if I'm wrong), is a wrap around the action AND the processing of the view (ie. the JSP/VM page etc.). So this forces your session to remain open until the view has been generated, and I think this is an unreasonable performance penalty (although people do it for the ease of doing it, I'd like to know how much it costs in sites that need performance...). This is only advantageous if you want to use lazy collections and want your view to drive the data fetching - which is really ugly and lazy technique IMO ;-) Regards, Jon ===== . ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://mail.messenger.yahoo.co.uk ------------------------------------------------------- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork ------------------------------------------------------- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork