How to call stored procedure by hibernate?
Posted
by
user367097
on Stack Overflow
See other posts from Stack Overflow
or by user367097
Published on 2011-01-18T13:02:05Z
Indexed on
2012/06/09
16:40 UTC
Read the original article
Hit count: 209
Hi I have an oracle stored procedure
GET_VENDOR_STATUS_COUNT(DOCUMENT_ID IN NUMBER , NOT_INVITED OUT NUMBER,INVITE_WITHDRAWN OUT NUMBER,...
rest all parameters are OUT parameters.
In hbm file I have written -
<sql-query name="getVendorStatus" callable="true">
<return-scalar column="NOT_INVITED" type="string"/>
<return-scalar column="INVITE_WITHDRAWN" type="string"/>
<return-scalar column="INVITED" type="string"/>
<return-scalar column="DISQUALIFIED" type="string"/>
<return-scalar column="RESPONSE_AWAITED" type="string"/>
<return-scalar column="RESPONSE_IN_PROGRESS" type="string"/>
<return-scalar column="RESPONSE_RECEIVED" type="string"/>
{ call GET_VENDOR_STATUS_COUNT(:DOCUMENT_ID , :NOT_INVITED ,:INVITE_WITHDRAWN ,:INVITED ,:DISQUALIFIED ,:RESPONSE_AWAITED ,:RESPONSE_IN_PROGRESS ,:RESPONSE_RECEIVED ) }
</sql-query>
In java I have written -
session.getNamedQuery("getVendorStatus").setParameter("DOCUMENT_ID", "DOCUMENT_ID").setParameter("NOT_INVITED", "NOT_INVITED")
... continue till all the parametes .
I am getting the sql exception
18:29:33,056 WARN [JDBCExceptionReporter] SQL Error: 1006, SQLState: 72000 18:29:33,056 ERROR [JDBCExceptionReporter] ORA-01006: bind variable does not exist
Please let me know what is the exact process of calling a stored procedure from hibernate. I do not want to use JDBC callable statement.
© Stack Overflow or respective owner