Why is 'SHOW WARNINGS' query issued here? (JPA/Hibernate/MySQL)
This is WHY show warnings is being issued:
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.handleAndClearWarnings()
is calling com.mysql.jdbc.StatementImpl.getWarnings()
.
A comment in the Hibernate source code says:
"See HHH-9174. Statement#getWarnings can be an expensive call for many JDBC libs. Don't do it unless the log level would actually allow a warning to be logged."
I upped the logging level on logback.xml on "org.hibernate" to ERROR. Profiling shows SHOW WARNINGS query is NO LONGER being issued.
This has made a marginal improvement in performance.
I would appreciate any input as to whether it is actually a good idea to disable SHOW WARNINGS here.