-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to get the actual database error.
PostPosted: Thu May 18, 2006 11:56 am 
Newbie

Joined: Fri Oct 22, 2004 10:55 am
Posts: 17
Hibernate Version: 2.1.6.
Database: Sybase 11.9.2

Our application is using hibernate and has been working fine for a while. Only issue I have is not getting the databse error message in case of the update failure, I get the following message instead.

Caused by: org.springframework.orm.hibernate.HibernateSystemException: SQL insert, update or delete failed (row not found); nested exception is net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)

When I run the same update statement manually against the database I get the correct error. In this case "Scale error during implicit conversion of the numeric value"

I am pretty sure there is a way to get the actual database error. Can somebody please tell me what I need to do.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 12:18 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 6:23 am
Posts: 91
How about catching the exception and then doing something like this:-


Code:
Throwable t = exception;
while (null != t.getCause()){
     t = t.getCause();
}
return t.getMessage();


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 12:23 pm 
Newbie

Joined: Fri Oct 22, 2004 10:55 am
Posts: 17
Actually I do not see the database exception anywhere as we print the complete exception in our log including all the nested exceptions.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.