Hi Guys,
I am using hibernate 3 version
i want to execute stored procedure using hibernate...
and i am using Oracle 10g
My procedure is as follows:
create or replace function selectAllItems
RETURN SYS_REFCURSOR
AS
st_cursor SYS_REFCURSOR;
BEGIN
OPEN st_cursor FOR
SELECT ITEM_ID, ITEM_STATUS,
SKU, ITEM_TYPE,
GW_CODE
FROM PC_PM_ITEMS_V;
RETURN st_cursor;
END;
and my mapping file contains:
<sql-query name="selectAllItems" callable="true">
<return alias="item" class="pm.model.PcPmItemsV">
<return-property name="itemId" column="ITEM_ID"/>
<return-property name="itemStatus" column="ITEM_STATUS"/>
<return-property name="gwCode" column="GW_CODE"/>
</return>
{ ? = call selectAllItems()}
</sql-query>
and in my code i m trying to execute that procedure:
try{
Query q = session.getNamedQuery("selectAllItems");
System.out.println(q.toString());
System.out.println(q.list());
}catch(Exception e){
e.printStackTrace();
}
and the exception:
org.hibernate.MappingException: Named query not known: selectAllItems
at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:48)
at pc.arch.service.genericSearch.ExecProc.main(ExecProc.java:23)
can anyone please help me where i am doing wrong....
Regards,
hiisi
_________________ Regards
.....Hiisi.....
|