SharedEntityManagerCreator detects JPA 2.2's getResultStream method as query-terminating

This commit also changes "hibval5Version" to the more general "hibvalVersion" build variable, and includes dependency updates to Caffeine 2.5.1 and JRuby 9.1.9.

Issue: SPR-13482
This commit is contained in:
Juergen Hoeller
2017-05-25 13:16:51 +02:00
parent 346d5d2fab
commit 6fcf3a104f
2 changed files with 15 additions and 14 deletions

View File

@@ -65,9 +65,9 @@ public abstract class SharedEntityManagerCreator {
private static final Class<?>[] NO_ENTITY_MANAGER_INTERFACES = new Class<?>[0];
private static final Set<String> transactionRequiringMethods = new HashSet<>(6);
private static final Set<String> transactionRequiringMethods = new HashSet<>(8);
private static final Set<String> queryTerminationMethods = new HashSet<>(3);
private static final Set<String> queryTerminatingMethods = new HashSet<>(8);
static {
transactionRequiringMethods.add("joinTransaction");
@@ -77,9 +77,10 @@ public abstract class SharedEntityManagerCreator {
transactionRequiringMethods.add("remove");
transactionRequiringMethods.add("refresh");
queryTerminationMethods.add("getResultList");
queryTerminationMethods.add("getSingleResult");
queryTerminationMethods.add("executeUpdate");
queryTerminatingMethods.add("executeUpdate");
queryTerminatingMethods.add("getSingleResult");
queryTerminatingMethods.add("getResultList");
queryTerminatingMethods.add("getResultStream");
}
@@ -376,7 +377,7 @@ public abstract class SharedEntityManagerCreator {
throw ex.getTargetException();
}
finally {
if (queryTerminationMethods.contains(method.getName())) {
if (queryTerminatingMethods.contains(method.getName())) {
// Actual execution of the query: close the EntityManager right
// afterwards, since that was the only reason we kept it open.
EntityManagerFactoryUtils.closeEntityManager(this.em);