-->
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.  [ 4 posts ] 
Author Message
 Post subject: question on HibernateException
PostPosted: Wed Mar 31, 2004 2:38 am 
Beginner
Beginner

Joined: Thu Jan 01, 2004 11:36 am
Posts: 23
Location: Belgium
Hi,

when I use session.update or session.saveSaveOrUpdate( object ) I can catch the HibernateException; typically this message will be rethrown to pass it to a level higher up and to display it on the screen.

The following code will give me the text of the HibernateException:

try {
...
session.update(object);

} catch( HibernateException e) {
throw new AppException("myFunction: " + e.getMessage());
}


In the case of a database error (constraint violations, values too large, ...) The message retrieved with e.getMessage() is " Could not execute JDBC batch update", which is not very detailed; in fact I would like to display the message corresponding the java.sql.SQLException (f.i.: "ORA-01401: inserted value too large for column").

Is there a way to do this ?

Thanks for any hints,

Jan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 31, 2004 10:11 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Exception are Nested ones, use getCause() to find the root one

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 03, 2004 7:53 am 
Newbie

Joined: Tue May 25, 2004 11:20 am
Posts: 17
Location: Munich, Germany
Can hibernate be configured to validate content against the defined (*.hbm.xml) column length?

-Chris


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 04, 2004 1:00 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No, why would you do that? You need your separate validation mechanism in any case.


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