Implement REF_CURSOR support for StoredProcedureQuery

Description

Environment

None

Activity

Show:
Steve Ebersole
October 8, 2013, 6:14 PM
Edited

Started playing with this some today. Here is what I found for PostgreSQL. Given a function defined to return a refcursor, here is what seems like is needed:

So against postgresql, when a parameter is registered with mode of REF_CURSOR we need to:

  1. Know to append the `? ='

  2. Validate that the REF_CURSOR is registered positionally and that its position is 1

  3. Disallow named parameters since the spec does not allow named/positional mixing and the REF_CURSOR parameter is implicitly positional

  4. Register the JDBC parameter as Types#OTHER

Steve Ebersole
October 8, 2013, 9:15 PM

Christian, I did some work on this today and got the basics working on PostgreSQL. I I have not tested out error handling, and I have not tested with Oracle. I will be pushing that work soon, if you wanted to try it out.

I am going to leave this open for now because I want to unify some internal support contracts.

This will be in the Beta5 release I do tomorrow too, hopefully with those unifications.

Steve Ebersole
October 8, 2013, 9:24 PM

For my own reference the contracts I would like to unify are:

  1. org.hibernate.procedure.spi.CallableStatementSupport

  2. org.hibernate.engine.jdbc.cursor.spi.RefCursorSupport

Christian Bauer
November 18, 2013, 5:20 AM

Steve, all my tests pass now and it looks like we have a very usable set of SP features. I haven't tested REF_CURSOR on Oracle though, only PostgreSQL.

Steve Ebersole
November 18, 2013, 1:57 PM

Awesome, thanks for trying it out Christian.

Fixed

Assignee

Steve Ebersole

Reporter

Christian Bauer

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Minor
Configure