diff --git a/Jenkinsfile b/Jenkinsfile
index 0f34e477b..906d2af6c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -24,13 +24,16 @@ pipeline {
}
options { timeout(time: 30, unit: 'MINUTES') }
environment {
+ DOCKER_HUB = credentials('hub.docker.com-springbuildmaster')
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
}
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
- docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
- sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean dependency:list test -Dsort -Dbundlor.enabled=false -U -B'
+ docker.image('adoptopenjdk/openjdk8:latest').inside('-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home') {
+ sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
+ sh 'PROFILE=all-dbs ci/test.sh'
+ sh "ci/clean.sh"
}
}
}
diff --git a/ci/clean.sh b/ci/clean.sh
new file mode 100755
index 000000000..7b38a05c9
--- /dev/null
+++ b/ci/clean.sh
@@ -0,0 +1,6 @@
+#!/bin/bash -x
+
+set -euo pipefail
+
+MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \
+ ./mvnw -s settings.xml clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa
diff --git a/ci/test.sh b/ci/test.sh
new file mode 100755
index 000000000..ffb33bccf
--- /dev/null
+++ b/ci/test.sh
@@ -0,0 +1,10 @@
+#!/bin/bash -x
+
+set -euo pipefail
+
+mkdir -p /tmp/jenkins-home/.m2/spring-data-jpa
+chown -R 1001:1001 .
+
+MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \
+ ./mvnw -s settings.xml \
+ -P${PROFILE} clean dependency:list test -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jpa
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index c5902fb8f..1c1562144 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,9 +23,12 @@
2.7.9
5.5.3.Final
- 0.10.3
- org.hibernate
+ 8.0.23
+ 42.2.19
2.6.0-SNAPSHOT
+ 0.10.3
+
+ org.hibernate
spring.data.jpa
@@ -34,6 +37,43 @@
+
+ all-dbs
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ mysql-test
+ test
+
+ test
+
+
+
+ **/MySql*IntegrationTests.java
+
+
+
+
+ postgres-test
+ test
+
+ test
+
+
+
+ **/Postgres*IntegrationTests.java
+
+
+
+
+
+
+
+
hibernate-next
@@ -116,6 +156,18 @@
+
+
+
+ org.testcontainers
+ testcontainers-bom
+ ${testcontainers}
+ pom
+ import
+
+
+
+
@@ -187,6 +239,40 @@
test
+
+
+ mysql
+ mysql-connector-java
+ ${mysql-connector-java}
+ test
+
+
+
+ org.testcontainers
+ mysql
+ test
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+
+
+
+
+ org.postgresql
+ postgresql
+ ${postgresql}
+ test
+
+
+
+ org.testcontainers
+ postgresql
+ test
+
+
org.threeten
threetenbp
@@ -325,6 +411,7 @@
+
default-test
@@ -333,7 +420,7 @@
- unit-tests
+ unit-test
test
@@ -345,7 +432,7 @@
- integration-tests
+ integration-test
test
@@ -359,6 +446,8 @@
**/*UnitTests.java
**/OpenJpa*
**/EclipseLink*
+ **/MySql*
+ **/Postgres*
-javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring}/spring-instrument-${spring}.jar
@@ -367,7 +456,7 @@
- eclipselink-tests
+ eclipselink-test
test
diff --git a/src/test/java/org/springframework/data/jpa/repository/procedures/MySqlStoredProcedureIntegrationTests.java b/src/test/java/org/springframework/data/jpa/repository/procedures/MySqlStoredProcedureIntegrationTests.java
new file mode 100644
index 000000000..2bde92038
--- /dev/null
+++ b/src/test/java/org/springframework/data/jpa/repository/procedures/MySqlStoredProcedureIntegrationTests.java
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2015-2021 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.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.data.jpa.repository.procedures;
+
+import static org.assertj.core.api.Assertions.*;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+import java.util.Properties;
+
+import javax.persistence.Entity;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.NamedStoredProcedureQuery;
+import javax.sql.DataSource;
+import javax.transaction.Transactional;
+
+import org.hibernate.dialect.MySQL8Dialect;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.data.jpa.repository.query.Procedure;
+import org.springframework.jdbc.datasource.init.DataSourceInitializer;
+import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
+import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.testcontainers.containers.MySQLContainer;
+
+import com.mysql.cj.jdbc.MysqlDataSource;
+
+/**
+ * Testcase to verify {@link org.springframework.jdbc.object.StoredProcedure}s work with MySQL.
+ *
+ * @author Gabriel Basilio
+ * @author Greg Turnquist
+ */
+@Transactional
+@ExtendWith(SpringExtension.class)
+@ContextConfiguration(classes = MySqlStoredProcedureIntegrationTests.Config.class)
+public class MySqlStoredProcedureIntegrationTests {
+
+ @Autowired EmployeeRepositoryWithNoCursor repository;
+
+ @Test // #2256
+ void testGenericSingleObjectFromResultSet() {
+
+ Object[] employee = repository.genericSingleObjectFromResultSet();
+
+ assertThat(employee).containsExactly( //
+ new Object[] { 3, "Fanny" }, //
+ new Object[] { 4, "Gabriel" });
+ }
+
+ @Test // #2256
+ void testGenericObjectsFromResultSet() {
+
+ List