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: Need help with Hibernate -Calling stored procedure
PostPosted: Thu Jun 19, 2008 10:37 am 
Newbie

Joined: Thu Jun 19, 2008 9:55 am
Posts: 3
Hi ,

I am new in hibernate. What i want to do is, I have to call a procedure.
without specifying the column names in mapping file.

My procedure accept 2 input parameters, it generate a unique number and return it as out parameter. In this scenario,i dont know How to map and how to write the code.

this is my procedure,

FUNCTION FETCHID(ID VARCHAR,LABEL VARCHAR) RETURN NUMBER IS
OUTID NUMBER;
BEGIN

select swith_id into OUTBATCHID from ps_async
where h1sd_xb_exec_oprid = ID and trunc(send_date) = trunc(sysdate);

RETURN OUTID;
exception
when no_data_found then
select h1sd_xb_batch_seq.nextval into OUTID from dual;
insert into ps_async values(ID,sysdate,OUTID);
commit;
insert into xb_batch values (OUTID,INLABEL,'NEW',ID,' ',0,trunc(sysdate),ID,trunc(sysdate),ID);
commit;
RETURN OUTID;
END;

My procdure is referring 2 table. I saw so many samples like

<sql-query name="selectAllEmployees_SP" callable="true">
<return alias="emp" class="employee">
<return-property name="empid" column="EMP_ID"/>

<return-property name="name" column="EMP_NAME"/>
<return-property name="address" column="EMP_ADDRESS"/>
{ ? = call selectAllEmployees(?,?) }
</return>
</sql-query>

I think these are not needed in my requirement.what i want to do is just send 2 string parameters and get out parameter. i dont know how to set return-property for my requirement.

Please suggest me how to do that,

Thanks in advance
Saravanan.


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.