When an org.hibernate.JDBCException occurrs (or a Subtype of this Exception) the sql statement is not visible in the Stacktrace.
For Example if i execute the following SQL statement with hibernate (on an Oracle DB which does not have a table or view 'nonexsiting'):
session.createSQLQuery("select * from nonexisting").list();
i get the following stacktrace:
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
...
Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: Table or view does not exist
...
The SQL statement is not shown in the stacktrace, however the Exception object has the information stored and can be accessed by exception.getSQL()
. It would extremely speed up debugging if this information would be available in the stacktrace too.
Anybody an idea why this information is not available in the stacktrace? Or how to enable the output of this information in the stacktrace?
By the way the hibernate version i used for this example is 3.3.1