-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to register Output Parameters using Hibernate
PostPosted: Wed Aug 12, 2009 12:46 pm 
Newbie

Joined: Sat Aug 08, 2009 2:06 pm
Posts: 3
Hi ,
I need to execute a stored procedure in SQL Servver ...

The problem is that i donĀ“t know how to register an out parameter to the
stored procedure using Hibernate 3 .
In JDBC using simple Callable statement The code would be:
Connection con = session.connection();
String query = "{call P5PORC_CONSULTAR_CUPO_CLIENTE (?,?,?,?,?)}";
CallableStatement cstmt = con.prepareCall(query);
cstmt.setString(1, "1234");
cstmt.registerOutParameter(2, Types.VARCHAR );
cstmt.registerOutParameter(3, Types.INTEGER);
cstmt.registerOutParameter(4, Types.VARCHAR);
cstmt.registerOutParameter(5, Types.VARCHAR);

cstmt.executeUpdate();

In Case Hibernate's support for stored procedures does not cover out parameters then is their another way to fetch Connection Object as session.conncetion(); method is depricated in Hibernate 3

Regards,
Mehak


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.