When an exception is thrown from the database or JDBC (SQLException) I need a way to dump the recent SQL(s) and bind variables.
We do this in an existing app (stored procedures) using an AOP aspect that wraps all stored proc calls in try/catch and if the catch is fired asks the stored procedure wrapper (Java) what SQL and Bind variables it would create given last method invocation
I'm pretty familiar with Hibernate but this gets deeper into the internals than I'm used to. Hibernate can log (debug) all SQL and bind variables but I can't run the app in debug mode in case I get an exception, this function needs to be reactive. Seems like AOP, Interceptors, and Events are all places for me to start looking, but I"m hoping someone with a deeper understanding of Hibernate internals could point me in the right direction.
Thanks!
|