-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Provide support for ParameterMode.REF_CURSOR - Hibernate [DATAJPA-1145] #1486
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
Jens Schauder commented Thanks for the PR. I'm not too fond to blindly try If it is thrown for some other reason than the one we are trying to handle, we'll probably get another exception and thereby hide the original one. I would be nicer to detect that we are dealing with hibernate in the first place and act accordingly. We probably should add this to Also, we should check what the spec says about this and if the behavior of Hibernate (or the others) is actually a bug |
Jens Schauder commented I looked into the spec and I'd say it is a Hibernate bug. From section 3.10.17.3 Stored Procedure Query Execution of the JPA2.1 spec:
In my interpretation, this means both Of course, this also means that we could switch to
|
Vishnudev K commented I have raised a ticket in hibernate bucket also.https://hibernate.atlassian.net/browse/HHH-11863 But I feel this is relatively a straight forward scenario that we can fix instead of depending on Hibernate |
Vishnudev K commented Hibrenate community is dead unlike spring data. :( It does't looks like we will have a fix from hibernate anytime soon, Can we have a fix here? |
Jens Schauder commented To defend the Hibernate community: We have some pretty stale issues as well ... Anyway: You are right, doesn't look like we get a fix from Hibernate anytime soon, so I think a workaround from our side would be appropriate. |
Jens Schauder commented A test case reproducing the issue would be most helpful |
Vishnudev K commented I have attached a zip file to replicate this issue. Thank you for sparing time on this |
Jens Schauder commented Oh, overlooked that one. I'll take a look |
Jens Schauder commented I wasn't able to reproduce the issue. The project in the attached file tries to create an EclipeLink entity manager (and fails due to missing/wrongly configured agent). The maven build doesn't work, because it references a snapshot version that is long gone. I created a little project to play around with stored procedures: https://github.com/schauder/calling-oracle-stored-procedures-with-cursors |
Vishnudev K commented I could replicate that issue, I gave you a pull request for the same. |
Vishnudev K commented Made changes? |
Jens Schauder commented I tried implementing a workaround. The idea is to add a before we try to access Unfortunately Hibernate returns This makes implementing a workaround rather invasive because we would now have to lug around the information if we are expecting a I updated the Hibernate issue with a link to my repo for demonstrating the behavior |
Vishnudev K commented I could see hibernate is returning callString.hasMoreResults() as false. Can we use a hasMoreResults check to determine whether to use getOutputParameterValue(1) or getResultList() |
Jens Schauder commented At this point, I don't want to put any more effort into this. If you can provide a pull request that works with the repository I used for testing, I'll take a look. |
Vishnudev K commented Please find the pull request for with the hibernate condition check Please find the branch for eclipse link demo for the same |
Jens Schauder commented This
really just works by accident. What it says is: if the is a resultset use the parameter; If there is no resultset use the resultset. If one uses a JPA provider without the bug that Hibernate has with a SP that has an |
MIhalcea Vlad commented The Hibernate issue is fixed and tested on Oracle and PostgreSQL. It will be available for 5.2.12 onwards |
Jens Schauder commented The issue does not appear any longer with the new Hibernate version |
Jens Schauder commented Batch closing resolved issue without a fix version and a resolution indicating that there is nothing to release (Won't fix, Invalid ...) |
Jens Schauder commented GabrielBB This issue was closed so I don't really understand what your PR is for. If you think there is something that needs fixing, please create a new issue. The description of the PR makes me sceptical though. |
GabrielBB commented Jens Schauder The procedure annotation has a logic to work without Named Procedure Queries, what I did is to extend that logic to return resultsets. Right now if you want to return a cursor the only way is to put all those annotations on top of your entity. But if you called a procedure with normal output variables you don’t need the annotations, it works with a simple |
GabrielBB commented Jens Schauder I will create another Ticket, indeed. Since my PR is doing several things |
Vishnudev K opened DATAJPA-1145 and commented
I was trying to execute a oracle procedure with spring-data-jpa and hibernate
MyEntity.java
MyRepository.java
But on spring-data we need to use getOutputParameterValue Method instead of getResultList
Then I discovered that the hibernate does not support REF_CURSOR
org.hibernate.procedure.internal.AbstractParameterRegistrationImpl.java
As per the ticket
https://jira.spring.io/browse/DATAJPA-652
its working fine on eclipse link, but broken in hibernate for quite sometime.
(I have taken the data/details from the original ticket)
Reference URL: #207
Attachments:
The text was updated successfully, but these errors were encountered: