|
16 | 16 |
|
17 | 17 | package org.springframework.data.jpa.repository.procedures;
|
18 | 18 |
|
19 |
| -import static org.assertj.core.api.Assertions.*; |
| 19 | +import static org.assertj.core.api.Assertions.assertThat; |
20 | 20 |
|
21 | 21 | import jakarta.persistence.Entity;
|
22 | 22 | import jakarta.persistence.EntityManagerFactory;
|
|
28 | 28 |
|
29 | 29 | import java.math.BigDecimal;
|
30 | 30 | import java.util.List;
|
| 31 | +import java.util.Map; |
31 | 32 | import java.util.Objects;
|
32 | 33 | import java.util.Properties;
|
33 | 34 |
|
|
45 | 46 | import org.springframework.data.jpa.repository.JpaRepository;
|
46 | 47 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
47 | 48 | import org.springframework.data.jpa.repository.query.Procedure;
|
48 |
| -import org.springframework.data.jpa.util.DisabledOnHibernate61; |
49 | 49 | import org.springframework.data.jpa.util.DisabledOnHibernate62;
|
50 | 50 | import org.springframework.jdbc.datasource.init.DataSourceInitializer;
|
51 | 51 | import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
|
66 | 66 | * @author Gabriel Basilio
|
67 | 67 | * @author Greg Turnquist
|
68 | 68 | * @author Yanming Zhou
|
| 69 | + * @author Thorben Janssen |
69 | 70 | */
|
70 |
| -@DisabledOnHibernate61 // GH-2903 |
71 | 71 | @Transactional
|
72 | 72 | @ExtendWith(SpringExtension.class)
|
73 | 73 | @ContextConfiguration(classes = PostgresStoredProcedureIntegrationTests.Config.class)
|
@@ -150,12 +150,28 @@ void testEntityListFromNamedProcedure() {
|
150 | 150 | new Employee(4, "Gabriel"));
|
151 | 151 | }
|
152 | 152 |
|
| 153 | + @Test // 3460 |
| 154 | + void testPositionalInOutParameter() { |
| 155 | + |
| 156 | + Map results = repository.positionalInOut(1, 2); |
| 157 | + |
| 158 | + assertThat(results.get("2")).isEqualTo(2); |
| 159 | + assertThat(results.get("3")).isEqualTo(3); |
| 160 | + } |
| 161 | + |
153 | 162 | @Entity
|
154 | 163 | @NamedStoredProcedureQuery( //
|
155 | 164 | name = "get_employees_postgres", //
|
156 | 165 | procedureName = "get_employees", //
|
157 | 166 | parameters = { @StoredProcedureParameter(mode = ParameterMode.REF_CURSOR, type = void.class) }, //
|
158 | 167 | resultClasses = Employee.class)
|
| 168 | + @NamedStoredProcedureQuery( // |
| 169 | + name = "positional_inout", // |
| 170 | + procedureName = "positional_inout_parameter_issue3460", // |
| 171 | + parameters = { @StoredProcedureParameter(mode = ParameterMode.IN, type = Integer.class), |
| 172 | + @StoredProcedureParameter(mode = ParameterMode.INOUT, type = Integer.class), |
| 173 | + @StoredProcedureParameter(mode = ParameterMode.OUT, type = Integer.class) }, // |
| 174 | + resultClasses = Employee.class) |
159 | 175 | public static class Employee {
|
160 | 176 |
|
161 | 177 | @Id
|
@@ -234,6 +250,9 @@ public interface EmployeeRepositoryWithRefCursor extends JpaRepository<Employee,
|
234 | 250 |
|
235 | 251 | @Procedure(name = "get_employees_postgres", refCursor = true)
|
236 | 252 | List<Employee> entityListFromNamedProcedure();
|
| 253 | + |
| 254 | + @Procedure(name = "positional_inout") |
| 255 | + Map positionalInOut(Integer in, Integer inout); |
237 | 256 | }
|
238 | 257 |
|
239 | 258 | @EnableJpaRepositories(considerNestedRepositories = true,
|
|
0 commit comments