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:
parent
346d5d2fab
commit
6fcf3a104f
16
build.gradle
16
build.gradle
|
|
@ -40,7 +40,7 @@ configure(allprojects) { project ->
|
||||||
ext.aspectjVersion = "1.9.0.BETA-5"
|
ext.aspectjVersion = "1.9.0.BETA-5"
|
||||||
ext.beanvalVersion = "1.1.0.Final"
|
ext.beanvalVersion = "1.1.0.Final"
|
||||||
ext.cacheApiVersion = "1.0.0"
|
ext.cacheApiVersion = "1.0.0"
|
||||||
ext.caffeineVersion = "2.5.0"
|
ext.caffeineVersion = "2.5.1"
|
||||||
ext.eclipselinkVersion = "2.6.4"
|
ext.eclipselinkVersion = "2.6.4"
|
||||||
ext.ehcacheVersion = "2.10.4"
|
ext.ehcacheVersion = "2.10.4"
|
||||||
ext.ehcachejcacheVersion = "1.0.1"
|
ext.ehcachejcacheVersion = "1.0.1"
|
||||||
|
|
@ -53,7 +53,7 @@ configure(allprojects) { project ->
|
||||||
ext.gsonVersion = "2.8.0"
|
ext.gsonVersion = "2.8.0"
|
||||||
ext.hamcrestVersion = "1.3"
|
ext.hamcrestVersion = "1.3"
|
||||||
ext.hibernate5Version = "5.2.10.Final"
|
ext.hibernate5Version = "5.2.10.Final"
|
||||||
ext.hibval5Version = "5.4.1.Final"
|
ext.hibvalVersion = "5.4.1.Final"
|
||||||
ext.hsqldbVersion = "2.4.0"
|
ext.hsqldbVersion = "2.4.0"
|
||||||
ext.httpasyncVersion = "4.1.3"
|
ext.httpasyncVersion = "4.1.3"
|
||||||
ext.httpclientVersion = "4.5.3"
|
ext.httpclientVersion = "4.5.3"
|
||||||
|
|
@ -504,7 +504,7 @@ project("spring-context") {
|
||||||
optional("javax.money:money-api:1.0.1")
|
optional("javax.money:money-api:1.0.1")
|
||||||
optional("org.eclipse.persistence:javax.persistence:${jpaVersion}")
|
optional("org.eclipse.persistence:javax.persistence:${jpaVersion}")
|
||||||
optional("javax.validation:validation-api:${beanvalVersion}")
|
optional("javax.validation:validation-api:${beanvalVersion}")
|
||||||
optional("org.hibernate:hibernate-validator:${hibval5Version}")
|
optional("org.hibernate:hibernate-validator:${hibvalVersion}")
|
||||||
optional("joda-time:joda-time:${jodaVersion}")
|
optional("joda-time:joda-time:${jodaVersion}")
|
||||||
optional("org.aspectj:aspectjweaver:${aspectjVersion}")
|
optional("org.aspectj:aspectjweaver:${aspectjVersion}")
|
||||||
optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
|
optional("org.codehaus.groovy:groovy-all:${groovyVersion}")
|
||||||
|
|
@ -805,7 +805,7 @@ project("spring-webflux") {
|
||||||
optional("org.jetbrains.kotlin:kotlin-stdlib-jre8:${kotlinVersion}")
|
optional("org.jetbrains.kotlin:kotlin-stdlib-jre8:${kotlinVersion}")
|
||||||
testCompile("io.projectreactor.addons:reactor-test")
|
testCompile("io.projectreactor.addons:reactor-test")
|
||||||
testCompile("javax.validation:validation-api:${beanvalVersion}")
|
testCompile("javax.validation:validation-api:${beanvalVersion}")
|
||||||
testCompile("org.hibernate:hibernate-validator:${hibval5Version}")
|
testCompile("org.hibernate:hibernate-validator:${hibvalVersion}")
|
||||||
testCompile("org.apache.tomcat:tomcat-util:${tomcatVersion}")
|
testCompile("org.apache.tomcat:tomcat-util:${tomcatVersion}")
|
||||||
testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
|
testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
|
||||||
testCompile("org.eclipse.jetty:jetty-server:${jettyVersion}")
|
testCompile("org.eclipse.jetty:jetty-server:${jettyVersion}")
|
||||||
|
|
@ -821,7 +821,7 @@ project("spring-webflux") {
|
||||||
testCompile("org.jetbrains.kotlin:kotlin-script-runtime:${kotlinVersion}")
|
testCompile("org.jetbrains.kotlin:kotlin-script-runtime:${kotlinVersion}")
|
||||||
testRuntime("org.jetbrains.kotlin:kotlin-script-util:${kotlinVersion}")
|
testRuntime("org.jetbrains.kotlin:kotlin-script-util:${kotlinVersion}")
|
||||||
testRuntime("org.jetbrains.kotlin:kotlin-compiler:${kotlinVersion}")
|
testRuntime("org.jetbrains.kotlin:kotlin-compiler:${kotlinVersion}")
|
||||||
testRuntime("org.jruby:jruby:9.1.8.0")
|
testRuntime("org.jruby:jruby:9.1.9.0")
|
||||||
testRuntime("org.python:jython-standalone:2.5.3")
|
testRuntime("org.python:jython-standalone:2.5.3")
|
||||||
testRuntime("org.webjars:underscorejs:1.8.3")
|
testRuntime("org.webjars:underscorejs:1.8.3")
|
||||||
testRuntime("org.glassfish:javax.el:3.0.1-b08")
|
testRuntime("org.glassfish:javax.el:3.0.1-b08")
|
||||||
|
|
@ -918,7 +918,7 @@ project("spring-webmvc") {
|
||||||
exclude group: "javax.servlet", module: "javax.servlet"
|
exclude group: "javax.servlet", module: "javax.servlet"
|
||||||
}
|
}
|
||||||
testCompile("javax.validation:validation-api:${beanvalVersion}")
|
testCompile("javax.validation:validation-api:${beanvalVersion}")
|
||||||
testCompile("org.hibernate:hibernate-validator:${hibval5Version}")
|
testCompile("org.hibernate:hibernate-validator:${hibvalVersion}")
|
||||||
testCompile("org.apache.httpcomponents:httpclient:${httpclientVersion}") {
|
testCompile("org.apache.httpcomponents:httpclient:${httpclientVersion}") {
|
||||||
exclude group: "commons-logging", module: "commons-logging"
|
exclude group: "commons-logging", module: "commons-logging"
|
||||||
}
|
}
|
||||||
|
|
@ -933,7 +933,7 @@ project("spring-webmvc") {
|
||||||
testCompile("org.jetbrains.kotlin:kotlin-script-runtime:${kotlinVersion}")
|
testCompile("org.jetbrains.kotlin:kotlin-script-runtime:${kotlinVersion}")
|
||||||
testRuntime("org.jetbrains.kotlin:kotlin-script-util:${kotlinVersion}")
|
testRuntime("org.jetbrains.kotlin:kotlin-script-util:${kotlinVersion}")
|
||||||
testRuntime("org.jetbrains.kotlin:kotlin-compiler:${kotlinVersion}")
|
testRuntime("org.jetbrains.kotlin:kotlin-compiler:${kotlinVersion}")
|
||||||
testRuntime("org.jruby:jruby:9.1.8.0")
|
testRuntime("org.jruby:jruby:9.1.9.0")
|
||||||
testRuntime("org.python:jython-standalone:2.5.3")
|
testRuntime("org.python:jython-standalone:2.5.3")
|
||||||
testRuntime("org.webjars:underscorejs:1.8.3")
|
testRuntime("org.webjars:underscorejs:1.8.3")
|
||||||
testRuntime("org.glassfish:javax.el:3.0.1-b08")
|
testRuntime("org.glassfish:javax.el:3.0.1-b08")
|
||||||
|
|
@ -1036,7 +1036,7 @@ project("spring-test") {
|
||||||
testCompile("javax.ejb:javax.ejb-api:${ejbApiVersion}")
|
testCompile("javax.ejb:javax.ejb-api:${ejbApiVersion}")
|
||||||
testCompile("javax.interceptor:javax.interceptor-api:${interceptorApiVersion}")
|
testCompile("javax.interceptor:javax.interceptor-api:${interceptorApiVersion}")
|
||||||
testCompile("org.hibernate:hibernate-core:${hibernate5Version}")
|
testCompile("org.hibernate:hibernate-core:${hibernate5Version}")
|
||||||
testCompile("org.hibernate:hibernate-validator:${hibval5Version}")
|
testCompile("org.hibernate:hibernate-validator:${hibvalVersion}")
|
||||||
// Enable use of the JUnitPlatform Runner
|
// Enable use of the JUnitPlatform Runner
|
||||||
testCompile("org.junit.platform:junit-platform-runner:${junitPlatformVersion}")
|
testCompile("org.junit.platform:junit-platform-runner:${junitPlatformVersion}")
|
||||||
testCompile("com.thoughtworks.xstream:xstream:${xstreamVersion}")
|
testCompile("com.thoughtworks.xstream:xstream:${xstreamVersion}")
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ public abstract class SharedEntityManagerCreator {
|
||||||
|
|
||||||
private static final Class<?>[] NO_ENTITY_MANAGER_INTERFACES = new Class<?>[0];
|
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 {
|
static {
|
||||||
transactionRequiringMethods.add("joinTransaction");
|
transactionRequiringMethods.add("joinTransaction");
|
||||||
|
|
@ -77,9 +77,10 @@ public abstract class SharedEntityManagerCreator {
|
||||||
transactionRequiringMethods.add("remove");
|
transactionRequiringMethods.add("remove");
|
||||||
transactionRequiringMethods.add("refresh");
|
transactionRequiringMethods.add("refresh");
|
||||||
|
|
||||||
queryTerminationMethods.add("getResultList");
|
queryTerminatingMethods.add("executeUpdate");
|
||||||
queryTerminationMethods.add("getSingleResult");
|
queryTerminatingMethods.add("getSingleResult");
|
||||||
queryTerminationMethods.add("executeUpdate");
|
queryTerminatingMethods.add("getResultList");
|
||||||
|
queryTerminatingMethods.add("getResultStream");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -376,7 +377,7 @@ public abstract class SharedEntityManagerCreator {
|
||||||
throw ex.getTargetException();
|
throw ex.getTargetException();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (queryTerminationMethods.contains(method.getName())) {
|
if (queryTerminatingMethods.contains(method.getName())) {
|
||||||
// Actual execution of the query: close the EntityManager right
|
// Actual execution of the query: close the EntityManager right
|
||||||
// afterwards, since that was the only reason we kept it open.
|
// afterwards, since that was the only reason we kept it open.
|
||||||
EntityManagerFactoryUtils.closeEntityManager(this.em);
|
EntityManagerFactoryUtils.closeEntityManager(this.em);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue