-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How Can I catch the Hibernate Exception???
PostPosted: Fri Jan 09, 2009 10:38 am 
Newbie

Joined: Thu Sep 11, 2008 3:35 pm
Posts: 8
Dear All

I am getting the following exception from Hibernate:

Code:
2009-01-09 09:18:29,743 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1, SQLState: 23000
2009-01-09 09:18:29,743 ERROR [org.hibernate.util.JDBCExceptionReporter] - ORA-00001: unique constraint (XXX_XXX_PK) violated


But When I have tried to catch with DataAccessException, it is not coming under that catch block.

Code:
catch (DataAccessException dae) {
//some logic...
         
}



What is the type of exception I need to use to catch this exception?

Thanks in advance.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2009 11:50 am 
Newbie

Joined: Thu Sep 11, 2008 3:35 pm
Posts: 8
I have figured it out with more detailed exception catching & logging. I used the following.
Code:
catch (ConstraintViolationException cve) {
         logger.debug("In ConstraintViolationException..");         
      }


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.