wood burning stoves
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
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: 17276

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 - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link: http://aspose.com/file-tools
subject: implementing stored procedure in hibernate
jQuery in Action, 3rd edition