• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does hibernate support Stored Procedure out parameters?

 
S Setty
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does hibernate provide support to register out parameters

if i have some thing like this in my hbm.cfg file

<sql-query name="mySproc" callable="true>

...

{call GET_EMPLOYEE_DETAILS(:empID,?,?)}
</sql-query>

Here the last 2 parameters are out type. How do invoke this procedure from the java code?

Query q = sesseion.getNamedQuery("mySproc");
q.setParameter("empID","123");
//Not sure how to register out parameters...??

I tried everything in my limits to get this working with no luck.

Appreciate if any one can answer.

Thanks
 
baran tamer
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so , have you managed to do that ?
if so can you tell me how ?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per the Hibernate documentation:

Hibernate 3 introduces support for queries via stored procedures and functions...The stored procedure/function must return a resultset as the first out-parameter to be able to work with Hibernate.

 
baran tamer
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so can i retrieve those 2 out parameters as a resultset or sp only returns a resultset from a select statement?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You can retreive one output parameter which is a result set. Your result set would presumably be a single row containing two fields.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic