File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
spring-jdbc/src/main/java/org/springframework/jdbc/datasource Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -124,7 +124,7 @@ public Connection getConnection() throws SQLException {
124
124
/**
125
125
* Wraps the given Connection with a proxy that delegates every method call to it
126
126
* but delegates {@code close()} calls to DataSourceUtils.
127
- * @param targetDataSource DataSource that the Connection came from
127
+ * @param targetDataSource the DataSource that the Connection came from
128
128
* @return the wrapped Connection
129
129
* @see java.sql.Connection#close()
130
130
* @see DataSourceUtils#doReleaseConnection
@@ -203,6 +203,10 @@ else if (method.getName().equals("isWrapperFor")) {
203
203
return true ;
204
204
}
205
205
}
206
+ else if (method .getName ().equals ("getWarnings" ) || method .getName ().equals ("clearWarnings" )) {
207
+ // Avoid creation of target Connection on pre-close cleanup (e.g. in Hibernate Session)
208
+ return null ;
209
+ }
206
210
else if (method .getName ().equals ("close" )) {
207
211
// Handle close method: only close if not within a transaction.
208
212
DataSourceUtils .doReleaseConnection (this .target , this .targetDataSource );
You can’t perform that action at this time.
0 commit comments