Browse Source

Handle all exceptions for stored proc out param retrieval in SharedEntityManagerCreator

Prior to this commit, the EntityManager was not closed in
SharedEntityManagerCreator.DeferredQueryInvocationHandler's
invoke(Object, Method, Object[]) method if an invocation of
getOutputParameterValue(*) threw an exception other than
IllegalArgumentException, which could lead to a connection leak.

This commit addresses this by catching RuntimeException instead of
IllegalArgumentException.

Closes gh-30161
pull/30169/head
Giuseppe 3 years ago committed by Sam Brannen
parent
commit
24b359d519
  1. 2
      spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java

2
spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java

@ -430,7 +430,7 @@ public abstract class SharedEntityManagerCreator { @@ -430,7 +430,7 @@ public abstract class SharedEntityManagerCreator {
entry.setValue(storedProc.getOutputParameterValue(key.toString()));
}
}
catch (IllegalArgumentException ex) {
catch (RuntimeException ex) {
entry.setValue(ex);
}
}

Loading…
Cancel
Save