|
From: Nick M. <nic...@gm...> - 2005-02-19 13:37:53
|
>> Hence, one web request will quickly >> use many connections, at the same time. How so? Why should there be more than one session for a given request? -Nick On Mon, 14 Feb 2005 16:36:19 +0100, Per Olesen <po...@no...> wrote: > Hi Juergen, > > Thank you for your comments. > > On Monday 14 February 2005 16:13, Juergen Hoeller wrote: > > > > I am aware of the Hibernate docs that the Session needs to be discarded > > when an exception was thrown. However, I find that an overly strict > > statement (just like "there is no such thing as a non-transactional > > Session", their famous statement from their forums mid last year). > > Okay, i tend to agree about it being an overly strict statement, also because > I've looked into SessionImpl.clear() and it does what we want :-) ... but: > When they've explicitly stated that a Session should not be reused in case of > exception, upcoming implementations of Session might break spring then. Can > it not? > > > Session.clear should be good enough for resetting an OSIV Session after a > > rollback. It's probably advisable to not use OSIV in single session mode at > > all if you want to avoid side effects completely. (Closing the Session and > > opening a new one during OSIV doesn't really add value here.) > > It will add the value that: > 1) the failing session is thrown away > 2) new calls into spring-managed beans will operate fine on the new session > > I know, that lazy-loading of objects from dead session will fail. > > > Have you considered using OpenSessionInViewFilter in "deferred close mode", > > that is, with the "singleSession" flag turned off? In that case, each > > transaction will use its own Hibernate Session, but all of those Sessions > > will be kept open until view rendering has completed. > > Yes, actually I have tried it out. But this solution does not scale very well. > A JDBC connection is assigned to each hibernate Session, so using deferred > close uses a connection for each session. Hence, one web request will quickly > use many connections, at the same time. > > Per > > -- > Per Olesen @ Nordija A/S - www.nordija.com - main#: +45 70 20 25 10 > email: po...@no... - cell#: +45 23 38 95 81 > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |