To answer your first question, that seems like it's easier said than done :) Tapestry 5 wants complete control over the URLs, which is why it's implemented as a filter to begin with (because it would be very difficult to map all the possible patterns to a servlet). It makes the page name lowercase, for example.
You are correct about the Session only opening a DB connection if it needs one. That was my bad assumption that it would be inefficient. So maybe the way to go is to declare the OSIV filter before Tapestry's (or in your case, one OSIV per database you use), and have it open a Session for every request. Jonathan Barker wrote: > > Hi. > > I also use Spring for Hibernate configuration, and the OSIV filter. I > tend > to need connections to multiple databases. > > Can you not configure the OSIV filter only for those URL patterns that > match > your tapestry pages? > > Also, and this is a question I don't know the answer to: Is opening a > session really expensive if you don't use it? I thought that Spring > provided a proxy that didn't have much cost until you actually went to use > it. > > Jonathan > >> -----Original Message----- >> From: trekmbikes [mailto:[EMAIL PROTECTED] >> Sent: Wednesday, October 24, 2007 1:50 PM >> To: users@tapestry.apache.org >> Subject: T5 / Spring / Hibernate Lazy Loading >> >> >> I'm brand new to Tapestry. I have a large application that uses Spring to >> configure the Hibernate SessionFactory. I have a request interceptor >> defined >> in Spring so that I can bind a Hibernate session to each request's >> thread. >> Closure of the session is deferred until the request returns, to prevent >> LazyLoadingExceptions (OpenSessionInViewInterceptor) >> >> I need to apply the same hibernate-session-per-reqeust feature to the new >> Tapestry code I'm writing, which will only be a small part of a much >> bigger >> system. >> >> My ideas are: >> a - Call Tapestry's filter methods from a custom Spring controller, then >> assign interceptors to the controller. This isn't working because the >> controller needs to be mapped to some URL pattern in web.xml (either like >> "/tap/*" or "*.tap"). It seems like Tapestry's filter doesn't like to be >> mapped to anything other than "/*". I need to keep the tapestry requests >> separate from all the other servlet mappings for now. I successfully >> mapped >> the controller to "/tap/*", which activated the interceptor, but then >> tapestry choked handling the real request. >> b - Change the OpenSessionInViewInterceptor to an >> OpenSessionInViewFilter. >> This would work if I declared the filter before the Tapestry filter in >> web.xml. But, some of my Spring servlets don't need this database >> connection, so I would be opening and closing the session unnecessarily. >> c - Use the Tapestry-Hibernate module and have Tapestry configure >> Hibernate >> independently from Spring. This is annoying because I'll have to move all >> my >> Hibernate configuration out of the spring XML it's in, and into a >> separate >> file. Plus, I'll have two complete SessionFactory instances when I really >> only needed one. >> d - I tried looking into the dispatcher classes but there's no >> "afterReturn()" method, only dispatch(). So I have no way to close the >> session/connection after the request returns. >> >> Suggestions would be much appreciated! >> -- >> View this message in context: http://www.nabble.com/T5---Spring--- >> Hibernate-Lazy-Loading-tf4685218.html#a13388806 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> 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] > > > -- View this message in context: http://www.nabble.com/T5---Spring---Hibernate-Lazy-Loading-tf4685218.html#a13394162 Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]