Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear authors,

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

Thanks,

Gian Franco Casula
 
Christian Bauer
author
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[...]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).
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!