-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Wrong handling of positional INOUT parameters when extracting output parameters #3460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you @thjanssen! You don't happen to have a test at hand that reproduces the problem? |
I'm working on it. I hope to provide one by Monday |
@christophstrobl I added a test case here: https://github.com/thjanssen/spring-data-jpa/blob/issue/3460/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/procedures/PostgresStoredProcedureIntegrationTests.java It fails when I run it within my IDE, but the Maven build still passes. Any idea why? BTW: The other test cases in that class were deactivated, but they seem to work fine. I've reactivated them on my branch. |
Suggested fix: I did a quick prototype implementation of this fix. You can find it here: 5e19dba |
thank you @thjanssen! |
Hey @christophstrobl Any suggestions on how to improve the result presentation? BTW: This change also fixes an issue in the current implementation that all positional output parameters use the same map key and override each other. |
not right off the top of my head. let me have a look at it (may take a bit of time). |
I think the |
@christophstrobl Awesome. I've send a PR |
Additional tests for stored procedure out parameter detection. Update Nullability annotations and Javadoc. Reduce method visibility. See: #3460
Additional tests for stored procedure out parameter detection. Update Nullability annotations and Javadoc. Reduce method visibility. See: #3460
When extracting positional output parameters of a stored procedure, the
StoredProcedureJpaQuery.extractOutputParameterValue
method tries calculating the position of an output parameter based on its index and the number of input parameters (https://github.com/spring-projects/spring-data-jpa/blob/main/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureJpaQuery.java#L146).Based on some tests in a client project, the
methodParameters.getNumberOfParameters()
method seems to count IN and INOUT parameters as input parameters. As a result the position of INOUT parameters get skipped instead of extracted.Example: When extracting the output parameters of a stored procedure with 2 INOUT and 7 OUT parameters, the method tries to extract positions 3-11 instead of positions 1-9.
The text was updated successfully, but these errors were encountered: