|
From: <jue...@we...> - 2003-12-10 19:09:40
|
Colin, I'm not sure if I understand the issue. If view code simply doesn't = catch any exceptions but always lets them through, the OpenSessionInView = handler will be able to properly close the Session in any case. It would = just be dangerous if the view code tried to handle exceptions itself, or = called down to code that tried to handle data access exceptions - a = proper web MVC view should *never* do such things. Essentially, this isn't different from normal business and data access = code based on Spring: Fatal runtime exceptions like DataAccessException = or TransactionExceptions should not be handled by application code but = always be propagated to the surrounding transaction or data access = template. I don't see why views are different in that respect, but maybe = I just don't get the point... Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Colin Sampaleanu Sent: Tuesday, December 09, 2003 3:23 PM To: spr...@li... Subject: Re: [Springframework-developer] Reworkings and new features While I know people are always asking for the Open Session in View=20 pattern support, I personally think it is a pretty dangerous pattern to=20 use. As per the Hibernate docs, =20 http://www.hibernate.org/hib_docs/reference/html/manipulating-data.html#m= anipulating-data-s13-4 if Session throws an exception, the Session should be closed and=20 discarded, as it will be inconsistent. The Open Session in View pattern=20 will work ok if the view code ensures that once a Hibernate exception is = handled no more db related code is used, but since the session handling=20 is above all the other code, it does not enforce this in any way. In=20 fact, if the view code is calling down to some service code that does=20 the db access itself, the view code may not even know that db access is=20 being done. At a minimum, I recommend we annotate the Javadocs for these classes=20 with a warning about this aspect... Regards, Colin ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for = IBM's Free Linux Tutorials. Learn everything from the bash shell to sys = admin. Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dclick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |