File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Q 4 C. Bauer & G. King (10): database exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Q 4 C. Bauer & G. King (10): database exceptions" Watch "Q 4 C. Bauer & G. King (10): database exceptions" New topic

Q 4 C. Bauer & G. King (10): database exceptions

Gian Franco
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Dear authors,

How are database exceptions, errors, e.g. due to
PK/FK constraints, passed back to the application
by Hibernate?


Gian Franco Casula

"Eppur si muove!"
Christian Bauer
Ranch Hand

Joined: Aug 31, 2004
Posts: 45
Hibernate doesn't add any uneccessary semantics to exceptions: You get a HibernateException which wraps a JDBC SQLException. In Hibernate 2.x, the HibernateException is a checked exception, Hibernate3 has a RuntimeException.

Co-Author of <a href="" target="_blank" rel="nofollow">Hibernate in Action</a>
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
[...]Hibernate3 has a RuntimeException.

This one is one of my favourites in Hibernate3. I have done this from the beginning of my Hibernate usage (putting there some dymnamic proxying).

blog -
Don't get me started about those stupid light bulbs.
subject: Q 4 C. Bauer & G. King (10): database exceptions