-->
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 return codes from database?
PostPosted: Wed May 02, 2007 11:07 am 
Beginner
Beginner

Joined: Wed Apr 05, 2006 8:16 pm
Posts: 20
Is there a recommended way to check for return codes from the DBMS for SQL executed through Hibernate?

Like something equivalent to Statement.getWarnings() ? We are experiencing a situation where DB2 is return -181 codes to us meaning our SQL statement failed, but we not seeing exceptions thrown when this happens, so up until now the statements have been silently bombing.

We are trying to see if there is a recommended way via Hibernate to check for return codes from the underlying DBMS? I know this is kind of a weird one. Thanks in advance for anyone who can help, or just for taking the time to read our post ! :),

Jim Bender
james.bender@53.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 1:32 pm 
Newbie

Joined: Tue May 01, 2007 2:59 pm
Posts: 4
Location: San Jose, CA
I'm not sure if this is related to your issue, but I have found that turning off JDBC batching gives me much better exceptions from Hibernate (at least with HSQLDB). With batching turned on, I just get a generic 'batch failed' exception, but with batching turned off, I get more meaningful SQL exceptions that Hibernate automatically maps to meaningfule Hibernate exceptions (like org.hibernate.exception.ConstraintViolationException).

Of course, this is only helpful for reproducing a problem in development, since turning off batching is likely to incur a performance hit.

Hope this helps!


Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Wed May 02, 2007 1:43 pm 
Beginner
Beginner

Joined: Wed Apr 05, 2006 8:16 pm
Posts: 20
That is a good tip -- I will have to keep that in mind. Thanks! :),

Jim


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.