1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2018 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.
@@ -65,9 +65,9 @@ public abstract class SharedEntityManagerCreator {
65
65
66
66
private static final Class <?>[] NO_ENTITY_MANAGER_INTERFACES = new Class <?>[0 ];
67
67
68
- private static final Set <String > transactionRequiringMethods = new HashSet <String >(6 );
68
+ private static final Set <String > transactionRequiringMethods = new HashSet <String >(8 );
69
69
70
- private static final Set <String > queryTerminationMethods = new HashSet <String >(3 );
70
+ private static final Set <String > queryTerminatingMethods = new HashSet <String >(8 );
71
71
72
72
static {
73
73
transactionRequiringMethods .add ("joinTransaction" );
@@ -77,9 +77,11 @@ public abstract class SharedEntityManagerCreator {
77
77
transactionRequiringMethods .add ("remove" );
78
78
transactionRequiringMethods .add ("refresh" );
79
79
80
- queryTerminationMethods .add ("getResultList" );
81
- queryTerminationMethods .add ("getSingleResult" );
82
- queryTerminationMethods .add ("executeUpdate" );
80
+ queryTerminatingMethods .add ("execute" ); // JPA 2.1 StoredProcedureQuery
81
+ queryTerminatingMethods .add ("executeUpdate" );
82
+ queryTerminatingMethods .add ("getSingleResult" );
83
+ queryTerminatingMethods .add ("getResultList" );
84
+ queryTerminatingMethods .add ("getResultStream" );
83
85
}
84
86
85
87
@@ -376,7 +378,7 @@ else if (targetClass.isInstance(proxy)) {
376
378
throw ex .getTargetException ();
377
379
}
378
380
finally {
379
- if (queryTerminationMethods .contains (method .getName ())) {
381
+ if (queryTerminatingMethods .contains (method .getName ())) {
380
382
// Actual execution of the query: close the EntityManager right
381
383
// afterwards, since that was the only reason we kept it open.
382
384
EntityManagerFactoryUtils .closeEntityManager (this .em );
0 commit comments