-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapped Hibernate SQLGrammarException loses the potential SQL statement that caused the exception [SPR-6304] #10970
Comments
Sébastien Launay commented A patch against 2.5.x trunk fixing this issue by using Spring HibernateJdbcException (used for JDBCException). By applying this patch the following stack trace will be used instead for my previous missing table:
I voluntarily reduce the stack trace for better readability. With this new information, I can concludes that the missing table is |
Juergen Hoeller commented This is a bit of a problem with Hibernate's JDBCException class: It stores context such as the SQL String but doesn't include it in the exception message... As a consequence, I've added that context explicitly when translating those exceptions: directly, without adding another exception to the chain. This should hopefully do the job as well. Juergen |
Sébastien Launay commented Adding another exception to the chain causes the stack to be more difficult to analyze but this was pretty straight forward for exposing:
In your fix we lose SQL state and error code but i do not know if this kind of information is useful. Anyway is it possible to see this modification backported in the 2.5.x maintenance branch? |
Tarun Kothuri commented This problem is back with Hibernate 4 and Spring 3.2.x |
Sébastien Launay opened SPR-6304 and commented
When an
org.hibernate.exception.SQLGrammarException
occurs because a table is missing i have the following stace trace:Because the
SQLGrammarException
is wrapped like any other exception we lose the SQL statement that caused the exception which can be handy in my case because I do not know which table does not exist :(.This maybe more of a Hibernate issue than a Spring issue (SQL in not append in the message but kept in a private field) but this is not the case for the parent class (
org.hibernate.JDBCException
) where the SQL statement is integrated by Spring in the stack trace.By looking at the 3.x source code, I think this issue also occurs in the future 3.0 version but I have not tested it.
Affects: 2.5.6
Attachments:
Referenced from: commits 86934e2
The text was updated successfully, but these errors were encountered: