[DATAJPA-1297] outputParameterName in @Procedure is not being used to create the StoredProcedureAttributes Created: 21/Mar/18  Updated: 13/Feb/19  Resolved: 16/Jan/19

Status: Closed
Project: Spring Data JPA
Component/s: Core
Affects Version/s: 2.0.5 (Kay SR5)
Fix Version/s: 2.2 M2 (Moore), 1.11.19 (Ingalls SR19), 2.0.14 (Kay SR14), 2.1.5 (Lovelace SR5)

Type: Bug Priority: Major
Reporter: Diego Díez Ricondo Assignee: Jens Schauder
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Last updater: Mark Paluch
Pull Request URL: https://github.com/spring-projects/spring-data-jpa/pull/260

 Description   

Currently, the parameter outputParameterName in the @Procedure annotation is not being used to create the corresponding StoredProcedureAttributes.

This is only a problem when the @Procedure method is being created to bind the parameters by name. However, since spring-boot 2.0, if you inherit from spring-boot-parent, you have by default the compiler flag 'parameters' enabled by default, making the procedure parameters bound by name without the need of explicitly define it.

The fix in StoredProcedureAttributeSource.createFrom it's trivial. Instead of passing null to the constructor of the StoredProcedureAttributes, we can pass the actual value defined in the annotation.
Before:

return new StoredProcedureAttributes(procedureName, null, method.getReturnType(), false);

After:

return new StoredProcedureAttributes(procedureName, procedure.outputParameterName(), method.getReturnType(), false);


 Comments   
Comment by Jens Schauder [ 13/Apr/18 ]

I wasn't able to reproduce the issue that's supposed to get fixed by the PR.

Please provide an example or even better a test case demonstrating the issue.

Comment by Diego Díez Ricondo [ 16/Dec/18 ]

Better late than never. Here is the testcase to reproduce the issue.

We are experiencing the issue using oracle as database. I've also made a test using MariaDB and in that case everything is working as expected.

https://github.com/didiez/test-DATAJPA-1297

Comment by Diego Díez Ricondo [ 16/Dec/18 ]

Reopening the issue as there is a test case reproducing the issue https://github.com/didiez/test-DATAJPA-1297

Generated at Wed Apr 24 04:40:28 UTC 2019 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.