|
From: Colin S. <col...@ex...> - 2004-07-29 17:59:55
|
I think this is cool and potentially pretty useful, in terms of simplifying lazy relation handling. Now somebody using Open Session in View now can not automatically swap out to this variant though, since if they are depending on sharing the same objects between different invocations down to transactional services, they are going to get exceptions from Hibernate when it sees that the objects are from different sessions. On the other hand, this is great for somebody that does want to call down once to a use-case defined service which retturns a graph of data, and now doesn't have to worry about touching all lazy relationships that might be needed. This actually brings the Hibernate scenario closer in line to what you can do with JDO 2 and handling of non-transactional graphs. Colin jürgen höller [werk3AT] wrote: >Colin, > >As I was just discussing the issue with a colleague of mine, and as you're known to not like the Open Session in View pattern ;-) > >What do you think regarding this "deferred close" mode for OpenSessionInViewFilter/Interceptor that I've introduced a while ago? That combination of correct transactional semantics plus lazy loading in the view is a quite nice way to avoid the drawbacks of the classic OpenSessionInViewFilter (what's now called "single session" mode). It should never cause side effects but still allow for flexible lazy loading. > >Juergen > > >-----Original Message----- >From: spr...@li... >[mailto:spr...@li...]On Behalf >Of jürgen höller [werk3AT] >Sent: Friday, July 09, 2004 7:39 PM >To: spr...@li... >Subject: [Springframework-developer] New deferred close mode for >OpenSessionInViewFilter/Interceptor > > >Due to numerous recent requests in that direction, I've implemented a new mode for OpenSessionInViewFilter/Interceptor, as alternative to a single session per request: > >Each data access operation respectively transactions uses its own Hibernate Session (like when not using Open Session in View). Each of those sessions will be registered for deferred close, though, actually processed at request completion. This does allow for lazy loading with each of those sessions, but you won't get a single first-level cache for the entire request, as there can be multiple Sessions. > >OpenSessionInViewFilter/Interceptor still uses a single session per request by default, but allows to activate deferred close mode instead by specifying "singleSession"="false" as init-param respectively bean property. > >Juergen > > |