HHH-9174 Increase performance
of SqlExceptionHelper#handleAndClearWarnings Conflicts: hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SqlExceptionHelper.java
This commit is contained in:
parent
61d2c0c049
commit
5979046d05
|
@ -313,13 +313,17 @@ public class SqlExceptionHelper {
|
|||
public void handleAndClearWarnings(
|
||||
Statement statement,
|
||||
WarningHandler handler) {
|
||||
try {
|
||||
walkWarnings( statement.getWarnings(), handler );
|
||||
}
|
||||
catch (SQLException sqlException) {
|
||||
// workaround for WebLogic
|
||||
LOG.debug( "could not log warnings", sqlException );
|
||||
}
|
||||
// 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.
|
||||
if (LOG.isEnabled(Level.WARN)) {
|
||||
try {
|
||||
walkWarnings( statement.getWarnings(), handler );
|
||||
}
|
||||
catch (SQLException sqlException) {
|
||||
// workaround for WebLogic
|
||||
LOG.debug( "could not log warnings", sqlException );
|
||||
}
|
||||
}
|
||||
try {
|
||||
// Sybase fail if we don't do that, sigh...
|
||||
statement.clearWarnings();
|
||||
|
@ -328,5 +332,4 @@ public class SqlExceptionHelper {
|
|||
LOG.debug( "could not clear warnings", sqle );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue