HHH-8983 log/clear Statement warnings on JdbcCoordinator#release

This commit is contained in:
Brett Meyer 2014-02-18 22:08:32 -05:00
parent 0dc24f1081
commit a7b4d6dcb2
2 changed files with 8 additions and 0 deletions

View File

@ -523,6 +523,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 ) {
final InvalidatableWrapper<Statement> wrapper = (InvalidatableWrapper<Statement>) statement;

View File

@ -268,6 +268,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}.