Normal java wisdom says that you catch the smallest group of exceptions that you want to handle (and thus expect to encounter): anything else should be handled at the highest error-catching level. You almost never want to catch Throwable, because that catches Errors too, and those are for things like linkage errors, virtual machine errors, and other stuff that you probably do want to barf about (after all, if someone deletes rt.jar while your programme is running, not even your error logging code is going to work).
Catching Excpetion is almost as bad, because that includes things like SecurityException and NullPointerException, genuine programming bugs. Again, no amount of logging is going to fix that. You would usually only want to catch these at the top level of a high-availability app, or during testing.
You can take the lazy option of catching HibernateException, but that means that you're trying to recover from things like TransactionExceptions and NonUniqueObjectExceptions, which again are programming bugs. Not recommended for professional applications: these should be caught outside of normal programme flow, at a very high level, so that the app can be restarted or core dumped. This is what I do, though I do it only a few levels higher, where I dump the current session, log stuff to file, inform the user, and create a new session to try to gracefully recover what I can.
The most correct thing to do is to do all possible negative tests, see what exceptions are thrown due to genuine user error, then write business logic to prevent calling hiberante code in any case that would cause it to barf. This is feasible in companies with good test regimes, but for the rest of us it's just too much overhead.
There are all sorts of articles on how and when to catch exceptions, but this summary should do for the average hibernate user: catch HibernateExceptions.
|