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(
|
public void handleAndClearWarnings(
|
||||||
Statement statement,
|
Statement statement,
|
||||||
WarningHandler handler) {
|
WarningHandler handler) {
|
||||||
try {
|
// See HHH-9174. Statement#getWarnings can be an expensive call for many JDBC libs. Don't do it unless
|
||||||
walkWarnings( statement.getWarnings(), handler );
|
// the log level would actually allow a warning to be logged.
|
||||||
}
|
if (LOG.isEnabled(Level.WARN)) {
|
||||||
catch (SQLException sqlException) {
|
try {
|
||||||
// workaround for WebLogic
|
walkWarnings( statement.getWarnings(), handler );
|
||||||
LOG.debug( "could not log warnings", sqlException );
|
}
|
||||||
}
|
catch (SQLException sqlException) {
|
||||||
|
// workaround for WebLogic
|
||||||
|
LOG.debug( "could not log warnings", sqlException );
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// Sybase fail if we don't do that, sigh...
|
// Sybase fail if we don't do that, sigh...
|
||||||
statement.clearWarnings();
|
statement.clearWarnings();
|
||||||
|
@ -328,5 +332,4 @@ public class SqlExceptionHelper {
|
||||||
LOG.debug( "could not clear warnings", sqle );
|
LOG.debug( "could not clear warnings", sqle );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue