Skip to content
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

Issue/3460 #3463

Closed
wants to merge 5 commits into from
Closed

Issue/3460 #3463

wants to merge 5 commits into from

Conversation

thjanssen
Copy link
Contributor

Fix handling of position INOUT parameters when extracting output parameters (issue 3460)

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

Added position information to ProcedureParameter class, set it in StoredProcedureAttributeSource.extractOutputParametersFrom(...), and use that position in StoredProcedureJpaQuery.extractOutputParameterValue to get the result value.
This change is based on the assumption that NamedStoredProcedureQuery.parameters() returns the parameters in the correct order. As far as I understand the rest of the code, it already makes this assumption when using positional parameters.

@pivotal-cla
Copy link

@thjanssen Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 7, 2024
@pivotal-cla
Copy link

@thjanssen Thank you for signing the Contributor License Agreement!

@@ -87,7 +88,7 @@ private List<ProcedureParameter> getParametersWithCompletedNames(List<ProcedureP

private ProcedureParameter getParameterWithCompletedName(ProcedureParameter parameter, int i) {

return new ProcedureParameter(completeOutputParameterName(i, parameter.getName()), parameter.getMode(),
return new ProcedureParameter(completeOutputParameterName(i, parameter.getName()), i+1, parameter.getMode(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we could reuse parameter.getPosition() here instead of i+1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that should be better. I've added the change to this PR

@christophstrobl christophstrobl self-assigned this May 8, 2024
@thjanssen
Copy link
Contributor Author

When this is fixed, do you think you could backport it to version 3.2.x?

@christophstrobl
Copy link
Member

christophstrobl commented May 13, 2024

I intend to back port the fix if things work out as expected.

christophstrobl pushed a commit that referenced this pull request May 13, 2024
Store the position of each output parameter in ProcedureParameter so that it can be used when extracting them from the result set.

Resolves: #3460
Original Pull Request: #3463
christophstrobl pushed a commit that referenced this pull request May 13, 2024
Store the position of each output parameter in ProcedureParameter so that it can be used when extracting them from the result set.

Resolves: #3460
Original Pull Request: #3463
@christophstrobl
Copy link
Member

Thank you @thjanssen - merged to main development line and back ported to 3.2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants