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
|