-->
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: Call stored procedure and get data returned in out parameter
PostPosted: Mon Jun 07, 2010 10:08 am 
Newbie

Joined: Thu Apr 22, 2010 2:25 pm
Posts: 6
How to retrieve data returned from out parameter in hibernate,
In regular connection i can do the following
Code:
StringBuilder hsql = new StringBuilder("call MYSCHEMA.TESTSP(?,?)");
CallableStatement query1 = connecion.prepareCall(hsql.toString());
query1.registerOutParameter(1, Types.CHAR);
query1.registerOutParameter(2, Types.CHAR);
String fileName = "$";
query1.setString(2, "");
query1.setString(1, fileName);
query1.executeUpdate();
String message = query1.getString(2);


I tried
Code:
String message ="";
Session session = sessionFactory.getCurrentSession();
StringBuilder hsql = new StringBuilder("call MYSCHEMA.TESTSP(?,?)");
Query query = session.createSQLQuery(
hsql.toString());
query.setParameter(0, "$");
query.setParameter("message", message);


But message comes out as blank, any ideas


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.