diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureIntegrationTests.java index 560642b65..8ac9e3cf5 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureIntegrationTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureIntegrationTests.java @@ -47,6 +47,7 @@ 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.data.jpa.util.DisabledOnHibernate61; import org.springframework.data.jpa.util.DisabledOnHibernate62; import org.springframework.jdbc.datasource.init.DataSourceInitializer; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; @@ -68,6 +69,7 @@ import org.testcontainers.containers.PostgreSQLContainer; * @author Greg Turnquist * @author Yanming Zhou */ +@DisabledOnHibernate61 // GH-2903 @Transactional @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = PostgresStoredProcedureIntegrationTests.Config.class) @@ -203,7 +205,7 @@ public class PostgresStoredProcedureIntegrationTests { @Bean(initMethod = "start", destroyMethod = "stop") public PostgreSQLContainer container() { - return new PostgreSQLContainer<>("postgres:9.6.12") // + return new PostgreSQLContainer<>("postgres:15.3") // .withUsername("postgres"); } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureNullHandlingIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureNullHandlingIntegrationTests.java index d1b51afac..b625b55b2 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureNullHandlingIntegrationTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureNullHandlingIntegrationTests.java @@ -44,6 +44,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Temporal; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.jpa.repository.query.Procedure; +import org.springframework.data.jpa.util.DisabledOnHibernate61; import org.springframework.jdbc.datasource.init.DataSourceInitializer; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean; @@ -62,6 +63,7 @@ import org.testcontainers.containers.PostgreSQLContainer; * * @author Greg Turnquist */ +@DisabledOnHibernate61 // GH-2903 @Transactional @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = PostgresStoredProcedureNullHandlingIntegrationTests.Config.class) @@ -109,7 +111,7 @@ public class PostgresStoredProcedureNullHandlingIntegrationTests { @Bean(initMethod = "start", destroyMethod = "stop") public PostgreSQLContainer container() { - return new PostgreSQLContainer<>("postgres:10.21") // + return new PostgreSQLContainer<>("postgres:15.3") // .withUsername("postgres"); } diff --git a/spring-data-jpa/src/test/resources/scripts/postgres-nullable-stored-procedures.sql b/spring-data-jpa/src/test/resources/scripts/postgres-nullable-stored-procedures.sql index 03a619176..82ee419ab 100644 --- a/spring-data-jpa/src/test/resources/scripts/postgres-nullable-stored-procedures.sql +++ b/spring-data-jpa/src/test/resources/scripts/postgres-nullable-stored-procedures.sql @@ -6,8 +6,7 @@ CREATE TABLE test_model CONSTRAINT test_model_pk PRIMARY KEY (ID) );; -CREATE OR REPLACE FUNCTION countByUuid(this_uuid uuid) - RETURNS int +CREATE OR REPLACE PROCEDURE countByUuid(IN this_uuid uuid) LANGUAGE 'plpgsql' AS $BODY$ @@ -18,13 +17,11 @@ BEGIN INTO c FROM test_model WHERE test_model.uuid = this_uuid; - RETURN c; END; $BODY$ ;; -CREATE OR REPLACE FUNCTION countByLocalDate(this_local_date DATE) - RETURNS int +CREATE OR REPLACE PROCEDURE countByLocalDate(IN this_local_date DATE) LANGUAGE 'plpgsql' AS $BODY$ @@ -35,7 +32,6 @@ BEGIN INTO c FROM test_model WHERE test_model.local_date = this_local_date; - RETURN c; END; $BODY$ ;; diff --git a/spring-data-jpa/src/test/resources/scripts/postgres-stored-procedures.sql b/spring-data-jpa/src/test/resources/scripts/postgres-stored-procedures.sql index 9d8226ee7..59097c851 100644 --- a/spring-data-jpa/src/test/resources/scripts/postgres-stored-procedures.sql +++ b/spring-data-jpa/src/test/resources/scripts/postgres-stored-procedures.sql @@ -8,38 +8,29 @@ CREATE TABLE employee INSERT INTO employee (ID, NAME) VALUES (3, 'Fanny');; INSERT INTO employee (ID, NAME) VALUES (4, 'Gabriel');; -CREATE OR REPLACE FUNCTION get_employees() - RETURNS refcursor +CREATE OR REPLACE PROCEDURE get_employees(OUT ref refcursor) LANGUAGE 'plpgsql' AS $BODY$ -DECLARE - ref refcursor; BEGIN OPEN ref FOR SELECT * FROM employee; - RETURN ref; END; $BODY$;; -CREATE OR REPLACE FUNCTION get_employees_count() - RETURNS integer +CREATE OR REPLACE PROCEDURE get_employees_count(OUT results integer) LANGUAGE 'plpgsql' AS $BODY$ BEGIN - RETURN (SELECT COUNT(*) FROM employee); + results = (SELECT COUNT(*) FROM employee); END; $BODY$;; -CREATE OR REPLACE FUNCTION get_single_employee() - RETURNS refcursor +CREATE OR REPLACE PROCEDURE get_single_employee(OUT ref refcursor) LANGUAGE 'plpgsql' AS $BODY$ -DECLARE - ref refcursor; BEGIN OPEN ref FOR SELECT * FROM employee WHERE employee.ID = 3; - RETURN ref; END; $BODY$;;