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.
|