Skip to content

Commit 871bb57

Browse files
committed
TransactionAwareDataSourceProxy locally handles get/clearWarnings call
Closes gh-23346
1 parent aebc485 commit 871bb57

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -203,6 +203,10 @@ else if (method.getName().equals("isWrapperFor")) {
203203
return true;
204204
}
205205
}
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+
}
206210
else if (method.getName().equals("close")) {
207211
// Handle close method: only close if not within a transaction.
208212
DataSourceUtils.doReleaseConnection(this.target, this.targetDataSource);

0 commit comments

Comments
 (0)