File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes How to use storedProcedure in Hibernate 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to use storedProcedure in Hibernate 3" Watch "How to use storedProcedure in Hibernate 3" New topic

How to use storedProcedure in Hibernate 3

Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146
I am new to Hibernate.
I have an application where stored procedure needs to be called from Hibernate 3 using
NamedQuery as given below. I am using oracle as DB. my stored procedure Name is: 'storedprocedure_test'

My question:
1. I am getting error as:

but, when i run that Stored procedure in DB, i am getting proper result.
Can anyone please help me how to execute the NamedQuery ?

my stored procedure is having two input parameters and two output parameters

Any one please help. I searched a lot in google but, no luck.

With Regards,
K. Tsang

Joined: Sep 13, 2007
Posts: 2231

I'm sure there are lots of resources on Google about calling store proc in Hibernate. Below is one for MySQL. The idea is the same for any other DB.
Hibernate calling MySQL store proc

Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146
Thanks Tsang,
I have already tried all the google options.
But, struck at one point. That is:

1. For Hibernate, Is it possible to call a stored Procedure which accepts 2 input parameters and 2 output parameteres?

Can you please help me with this?

jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi ,

Hibernate dosent suuport multiple output parameters refer this thread.
and multiple input parameters can be pass to stored procedure.

Consider Paul's rocket mass heater.
subject: How to use storedProcedure in Hibernate 3
Similar Threads
Hibernate; error executing stored procedure
Not able to execute Select and delete queries
Facing the problem while reterving the resultsets in java from named query function in hibernate
cannot insert record in MS SQLServer 2000
Batch Update Failure