-->
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: Executing stored Procedure...
PostPosted: Mon Apr 03, 2006 3:10 am 
Newbie

Joined: Tue Feb 07, 2006 2:02 am
Posts: 12
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.....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 5:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so you havent loaded that particular mapping file.

_________________
Max
Don't forget to rate


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.