-->
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.  [ 2 posts ] 
Author Message
 Post subject: Setting parameters to the Stored Procedure.
PostPosted: Wed Nov 08, 2006 3:50 am 
Newbie

Joined: Fri Oct 27, 2006 7:32 am
Posts: 9
Hi All,


I am using Hibernate + Spring. I wrote a oracle stored Pocedure that retireves the rows from the DEPT table based on some condition like where
deptno is 10 something like this,

Proc name is : GET_DEPT_PROCEDURE

I am calling this procedure thru named query as follows...

<sql-query name="name3" callable="true">
<return alias="DeptObj" class="secondEx.DeptObj">
{ call GET_DEPT_PROCEDURE(?,:dnumber) }
</sql-query>

where dnumber is the variable name that has to be set as where condition in Implementation class..

How to set the parameters to the stored procedure and call....I am using

getHibernateTemplate()..

If it has no input condition it will work with,

getHibernateTemplate().findByNamedQuery("name3");

Problem is with the input parameters.. Pls help me ....


Thnx in advance..

_________________
Sujatha K


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 10, 2006 12:14 am 
Newbie

Joined: Fri Oct 27, 2006 7:32 am
Posts: 9
Hi,

I have solved this problem...I foun dthe following statement working..

Query f = getHibernateTemplate().getSessionFactory().openSession().getNamedQuery("name3").setParameter("h", new Integer(299)) .setParameter("dnumber","newDept") ;
return (ArrayList)f.list();

_________________
Sujatha K


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

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.