Im changing my +0 vote to +1 after seeing the arguments and after having discussed it with my coworkers :)
Reasons: 1. It simplifies the exception handling. (You only got one exception to catch) 2. Nested exceptions is becoming the defactor standard so no problems here 3. Hibernate can add semantic understanding to the exception. Bad things: 0. One developer said: I would like to know if the HibernateException actually originated from an SQLException...before you would know it directly, in the future you could just "traverse" the chains to the excpeiton to check the reason - so that is actually not a "bad thing" :) 1. It will break existing code and exception handling code.....but if ones exception handling code is so hairy that they cannot survive this change it would be a good time to clean up anyway :) /max ----- Original Message ----- From: "Gavin King" <[EMAIL PROTECTED]> To: "Timothy Kettering" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, January 06, 2003 4:48 AM Subject: RE: [Hibernate] Suggestion: Encapsulate SQLException in HibernateException This is exactly the kind of input I was looking for :) And your point is quite correct; even if we *did* rationalize the Session interface to throw only HibernateExceptions, in general, we *still* wouldn't be able to do this: Session s = sf.openSession() try { // do some work } catch (HibernateException he) { // yada yada yada } finally { s.close(); } Why? because "yada yada yada" needs to happed no matter *what* kind of exception occurred (even RuntimeExceptions). However, there is another argument for this change, that no-one has really brought up. Nested exceptions let us add some contextual information to the wrapped SQLException. So the developer could see what Hibernate was doing when the SQLException occurred. At present you see a stack trace which is somewhat helpful but probably less helpful than what we could do with nesting. > This is just my two cents here, and I'm still relatively new to those > parts, but here goes: > > I've been doing development on database backed persistence stuff, and > after a brief unfullfilling fling with Castor, I ditched that > and went > with Hibernate and lets just say that this thing is a whole > lot better. > > But I digress. Regarding SQLExceptions, I wrap everything up in the > persistence layer with it's own exception, so theres just one > exception > to throw in the application when accessing the data, but in the > persitence class file and with Hibernate, I found myself having to > catch 4-5 different types of exceptions when doing a hibernate query, > and I eventually just gave up on that and just put them in a vanilla > Exception try-catch block and sort it out afterwards. > > I guess my point here is that in my case, I'm already catching it all > with Exception so it doesn't make much difference to me > because of all > the other exceptions I have to catch anyway compels me to use this. > But if the exceptions could be consolidated to just one or two types, > then i would see a benefit to catching them individually. > > I don't know how others do it, they may have a better > solution or know > better than I do. But you wanted feelings, man! :) > > -tim > > On Sunday, January 5, 2003, at 10:09 PM, Gavin King wrote: > > > Has this thread died? > > > > I still havn't got a really good feeling for what other > people think > > about this issue.... > > > >> -----Original Message----- > >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > >> Sent: Saturday, 4 January 2003 1:46 AM > >> To: [EMAIL PROTECTED] > >> Subject: [Hibernate] Suggestion: Encapsulate SQLException in > >> HibernateException > >> > >> > >> Hi, > >> > >> I was thinking about wrapping SQLException in > HibernateException, so > >> that we don't need to worry about catch HibernateException and > >> SQLException. Since now the work is focused on some changes for > >> Hibernate 2, this could be the right time to do this kind > of change. > >> This would simplify the error handling in the applications. > >> > >> Robson > >> > >> > >> > >> ------------------------------------------------------- > >> This sf.net email is sponsored by:ThinkGeek > >> Welcome to geek heaven. > >> http://thinkgeek.com/sf > >> _______________________________________________ > >> hibernate-devel mailing list [EMAIL PROTECTED] > >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel > >> > > > > > > ********** CAUTION - Disclaimer ********** > > This message may contain privileged and confidential > information. If > > you are not the intended recipient of this message (or > responsible for > > delivery of the message to such person) you are hereby > notified that > > any use, dissemination, distribution or reproduction of this message > > is prohibited. If you have received this message in error, > > you should destroy it and kindly notify the sender by reply > > e-mail. Please advise immediately if you or your employer > > do not consent to Internet e-mail for messages of this kind. > > Opinions, conclusions and other information in this > > message that do not relate to the official business of > > Expert Information Services Pty Ltd ("The Company") > > shall be understood as neither given nor endorsed by it. > > > > The Company advises that this e-mail and any attached > > files should be scanned to detect viruses. The Company accepts no > > liability for loss or damage (whether caused by negligence or not) > > resulting from the use of any attached files. > > **EIS******** End of Disclaimer ********** > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > hibernate-devel mailing list [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel