This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes implementing stored procedure in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "implementing stored procedure in hibernate" Watch "implementing stored procedure in hibernate" New topic

implementing stored procedure in hibernate

Al McCoy

Joined: Nov 19, 2007
Posts: 3
Most of the examples posted in this forum and on the hibernate website cover cases where the procedure returns a ref cursor.

1. Could someone point me to examples of using hibernate where the procedure simply return an out parameter which is not a ref cursor but some other types (E.g NUMBER, VARCHAR) ?

2. I believe Hibernate has restrictions on the number of out parameter that can be specified. What is the optimal workaround for such a situation.


Mark Spritzler

Joined: Feb 05, 2001
Posts: 17250

Yep you are right because Hibernate has restrictions, which is based on Oracle's JDBC driver not implementing to the spec/standard. (Sorry Michael, not directed at you there )

In order to work with Stored Procedures here are the rules

1. You can only have one out parameter
2. That out parameter must be the first parameter
3. That out parameter must be a ref-cursor.

Say you want to call a stored procedure that does not follow those rules, well then you would have to use a SQLQuery object and call the stored procedure is a different manner like in Oracle you can call "select myProcedure(param1, param2) from dual"


Have fun.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: implementing stored procedure in hibernate