HHH-8983 log/clear Statement warnings on JdbcCoordinator#release
Conflicts: hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SqlExceptionHelper.java
This commit is contained in:
parent
0c0519ebb3
commit
4fd94c1fd3
|
@ -483,6 +483,10 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
|||
@SuppressWarnings({ "unchecked" })
|
||||
protected void close(Statement statement) {
|
||||
LOG.tracev( "Closing prepared statement [{0}]", statement );
|
||||
|
||||
// Important for Statement caching -- some DBs (especially Sybase) log warnings on every Statement under
|
||||
// certain situations.
|
||||
sqlExceptionHelper().logAndClearWarnings( statement );
|
||||
|
||||
if ( statement instanceof InvalidatableWrapper ) {
|
||||
InvalidatableWrapper<Statement> wrapper = ( InvalidatableWrapper<Statement> ) statement;
|
||||
|
|
|
@ -28,15 +28,14 @@ import java.sql.SQLException;
|
|||
import java.sql.SQLWarning;
|
||||
import java.sql.Statement;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.logging.Logger.Level;
|
||||
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.exception.internal.SQLStateConverter;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.logging.Logger.Level;
|
||||
|
||||
/**
|
||||
* Helper for handling SQLExceptions in various manners.
|
||||
|
@ -246,6 +245,10 @@ public class SqlExceptionHelper {
|
|||
public void logAndClearWarnings( Connection connection ) {
|
||||
handleAndClearWarnings(connection, STANDARD_WARNING_HANDLER);
|
||||
}
|
||||
|
||||
public void logAndClearWarnings(Statement statement) {
|
||||
handleAndClearWarnings( statement, STANDARD_WARNING_HANDLER );
|
||||
}
|
||||
|
||||
/**
|
||||
* General purpose handling of warnings associated with a JDBC {@link Connection}.
|
||||
|
@ -294,5 +297,4 @@ public class SqlExceptionHelper {
|
|||
LOG.debug("could not clear warnings", sqle);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue