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.
@@ -130,7 +130,7 @@ public Connection getConnection() throws SQLException {
130
130
/**
131
131
* Wraps the given Connection with a proxy that delegates every method call to it
132
132
* but delegates {@code close()} calls to DataSourceUtils.
133
- * @param targetDataSource DataSource that the Connection came from
133
+ * @param targetDataSource the DataSource that the Connection came from
134
134
* @return the wrapped Connection
135
135
* @see java.sql.Connection#close()
136
136
* @see DataSourceUtils#doReleaseConnection
@@ -207,6 +207,10 @@ else if (method.getName().equals("isWrapperFor")) {
207
207
return true ;
208
208
}
209
209
}
210
+ else if (method .getName ().equals ("getWarnings" ) || method .getName ().equals ("clearWarnings" )) {
211
+ // Avoid creation of target Connection on pre-close cleanup (e.g. in Hibernate Session)
212
+ return null ;
213
+ }
210
214
else if (method .getName ().equals ("close" )) {
211
215
// Handle close method: only close if not within a transaction.
212
216
DataSourceUtils .doReleaseConnection (this .target , this .targetDataSource );
You can’t perform that action at this time.
0 commit comments