aspose file tools
The moose likes Other Application Frameworks and the fly likes Hibernate exception handling Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Reply Bookmark "Hibernate exception handling" Watch "Hibernate exception handling" New topic
Author

Hibernate exception handling

Mark Hero
Greenhorn

Joined: Oct 11, 2011
Posts: 1
I've got a little 'complex'(long) question.

I'm using Hibernate/JPA to make transactions with a DB.

I'm not the DBA, and a client consumes my application, a RESTful web service. My problem is that the DB is altered (not very often, but it still changes). Also, the client does not always respect input for my application (length, type, etc.). When this happens Hibernate throws an exception. The exception is difficult to translate and read from the log, because it has nested exceptions and consists of a lot of text: like I said, very difficult to understand.

I want to know if it's possible to handle exceptions on entity level, throwing maybe a customized exception.

I thank your patience and help in advance.

PD This is the structure of my test app, validating that two fields are equal:

App.java


FieldMatch.java

FieldMatchValidator.java


Stock.java


HibernateUtil.java


 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Hibernate exception handling
 
Similar Threads
A question on object cloning.
Best Method for the Singleton Design Pattern
Can't use Optimistic Locking
Inner join problem
JPA criteriaBuilder method not found