Skip to content

Commit

Permalink
TransactionAwareDataSourceProxy locally handles get/clearWarnings call
Browse files Browse the repository at this point in the history
Closes gh-23346
  • Loading branch information
jhoeller committed Aug 1, 2019
1 parent aebc485 commit 871bb57
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -203,6 +203,10 @@ else if (method.getName().equals("isWrapperFor")) {
return true;
}
}
else if (method.getName().equals("getWarnings") || method.getName().equals("clearWarnings")) {
// Avoid creation of target Connection on pre-close cleanup (e.g. in Hibernate Session)
return null;
}
else if (method.getName().equals("close")) {
// Handle close method: only close if not within a transaction.
DataSourceUtils.doReleaseConnection(this.target, this.targetDataSource);
Expand Down

0 comments on commit 871bb57

Please sign in to comment.