Closed spring-projects-issues closed 4 years ago
Thomas Darimont commented
Hello Marcos,
thanks for reporting this!
It seems that we are just missing the REF_CURSOR
mode in https://github.com/spring-projects/spring-data-jpa/blob/e8436d5de78b8e87a1eb5ac26000dfebb5c2537d/src/main/java/org/springframework/data/jpa/repository/query/StoredProcedureAttributeSource.java#L103
I think using query.getOutputParameterValue(...)
is the correct thing to do according to the EclipseLink examples:
https://wiki.eclipse.org/EclipseLink/Release/2.5/JPA21#OUT_parameter_Example -> Ref cursor Example
and the JPA Wiki:
http://en.wikibooks.org/wiki/Java_Persistence/Advanced_Topics#JPA_2.1_StoredProcedureQuery -> "Example calling a named stored procedure with a cursor output parameter"
Cheers, Thomas
Thomas Darimont commented
Hello Marcos,
I was able to get it working - would you mind giving the above PR a try? A sample app (Spring Boot + Eclipse Link + Oracle) is attached for reference. The stored procedure with the cursor out parameter is contained in the following gist: https://gist.github.com/thomasdarimont/129bc15d0ccc459610c2
Cheers, Thomas
Thomas Darimont commented
Sample app spring-data-jpa-bug-datajpa-652
Marcos Oliveira Junqueira commented
Hi Thomas, the current version of spring-data-jpa only works with the link eclipse, with hibernate does not work, you can check it?
I'll run your gist later.
Att. Marcos
Thomas Darimont commented
Please revise
Raja commented
Is this issue been fixed in springdatajpa for hibernate. Hibernate insists to invoke via results rather than getOutPutparamatervalues.
or should specify any type paramater in @StoredProcedureParameter
to make it work . pls assist
Vishnudev K commented
experience this issue using hibernate. cant we fix this one using query.getResultList() instead of query.getOutputParameterValue(4);?
GabrielBB commented
Vishnudev K Raja Oliver Drotbohm Marcos Oliveira Junqueira I just made a Pull Request to finally fix this: https://github.com/spring-projects/spring-data-jpa/pull/406
Marcos Oliveira Junqueira opened DATAJPA-652 and commented
As described here https://github.com/spring-projects/spring-data-examples/issues/44 I was trying to execute a procedure on spring-data-jpa with hibernate on oracle 11g database.
But spring-data uses getOutputParameterValue Method instead of getResultList
And it makes a lot of problems with hibernate
Hibernate does not support REF_CURSOR: https://github.com/hibernate/hibernate-orm/blob/4.3.7.Final/hibernate-core/src/main/java/org/hibernate/procedure/internal/AbstractParameterRegistrationImpl.java
Finally, I moved to the EclipseLink and it worked perfectly
Affects: 1.6.4 (Dijkstra SR4)
Reference URL: https://github.com/spring-projects/spring-data-examples/issues/44
Attachments:
Referenced from: pull request https://github.com/spring-projects/spring-data-jpa/pull/130
0 votes, 6 watchers