-->
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: problem executing oracle stored procedure
PostPosted: Tue Aug 31, 2010 3:47 am 
Newbie

Joined: Tue Aug 31, 2010 3:40 am
Posts: 2
Having problems executing stored procedure using oracle (NHibernate.Dialect.Oracle10gDialect).

Using NHibenate version : 2.1.0.3001

Stored proc looks like this :
Code:
CREATE OR REPLACE
procedure ORDERSTEST(c_test out sys_refcursor) is
BEGIN
  open c_test for select * from orders;
END ORDERSTEST;


My mapping file looks like this :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
   <class name="Niras.Lucrative.Entity.Orders,Niras.Lucrative.Entity" table="ORDERS">

      <id name="Id" column="ID" type="Int32">
         <generator class="native">
            <param name="sequence">ORDERS_SEQ</param>
         </generator>
      </id>
      
      <property column="GML" type="string" name="Gml" length="2147483647" />
      <property column="WKT" type="string" name="Wkt" length="2147483647" />
    <property column="GUID" type="Guid" name="Guid" />
      <many-to-one name="KundeId" class="Niras.Lucrative.Entity.Kunde,Niras.Lucrative.Entity" cascade="save-update">
         <column name="KUNDE_ID" />
      </many-to-one>
      <many-to-one name="KundeKontaktId" class="Niras.Lucrative.Entity.KundeKontakt,Niras.Lucrative.Entity" cascade="save-update" >
         <column name="KUNDE_KONTAKT_ID" />
      </many-to-one>
      <many-to-one name="OutputformatId" class="Niras.Lucrative.Entity.Outputformat,Niras.Lucrative.Entity">
         <column name="OUTPUTFORMAT_ID" />
      </many-to-one>
      <many-to-one name="ScaleId" class="Niras.Lucrative.Entity.Scale,Niras.Lucrative.Entity">
         <column name="SCALE_ID" />
      </many-to-one>
      <many-to-one name="PapersizeId" class="Niras.Lucrative.Entity.Papersize,Niras.Lucrative.Entity">
         <column name="PAPERSIZE_ID" />
      </many-to-one>
      <many-to-one name="OwnerId" class="Niras.Lucrative.Entity.Owner,Niras.Lucrative.Entity">
         <column name="OWNER_ID" />
      </many-to-one>
      <bag name="Lergraveanmodninglist" cascade="all" inverse="true">
         <key>
            <column name="ORDERS_ID" />
         </key>
         <one-to-many  class="Niras.Lucrative.Entity.LerGraveanmodning,Niras.Lucrative.Entity"/>
      </bag>
    <bag name="Overviewmaplist" cascade="all-delete-orphan" inverse="true">
      <key>
        <column name="ORDERS_ID" />
      </key>
      <one-to-many  class="Niras.Lucrative.Entity.OverviewMap,Niras.Lucrative.Entity"/>
    </bag>
    <bag name="Loglist" cascade="all-delete-orphan" inverse="true">
         <key>
            <column name="ORDERS_ID" />
         </key>
         <one-to-many  class="Niras.Lucrative.Entity.Log,Niras.Lucrative.Entity"/>
      </bag>
      <bag name="Planlist" cascade="all" inverse="true">
         <key>
            <column name="ORDER_ID" />
         </key>
         <one-to-many  class="Niras.Lucrative.Entity.Plan,Niras.Lucrative.Entity"/>
      </bag>
      <bag name="Remarklist" cascade="all" inverse="true">
         <key>
            <column name="ORDERS_ID" />
         </key>
         <one-to-many  class="Niras.Lucrative.Entity.Remark,Niras.Lucrative.Entity"/>
      </bag>
      
   </class>
   
   <sql-query name="Orderssearch">
        <return alias="searchOrders" class="Niras.Lucrative.Entity.Orders,Niras.Lucrative.Entity" /> 
         { CALL ORDERSTEST(?)  }
    </sql-query>
</hibernate-mapping>


and my C# code looks like this :
Code:
Session.GetNamedQuery("Orderssearch").List<IOrders>();


and im getting the following error :
Quote:
NHibernate.QueryException: Expected positional parameter count: 1, actual parameters: [] [{ CALL ORDERSTEST(?) }]
at NHibernate.Impl.AbstractQueryImpl.VerifyParameters(Boolean reserveFirstParameter)
at NHibernate.Impl.AbstractQueryImpl.VerifyParameters()
at NHibernate.Impl.SqlQueryImpl.VerifyParameters()
at NHibernate.Impl.SqlQueryImpl.List<T>()
at Niras.Lucrative.Business.OrdersDomain.SearchOrders(Nullable`1 ownerId, IList`1 orderStatusId, Nullable`1 fromDate, Nullable`1 toDate, Nullable`1 kundeKontaktId, String wktGeometry) in OrdersDomain.cs: line 206
at Niras.Lucrative.Business.Tests.OrdersDomainTest.SearchOrdersTest() in OrdersDomainTest.cs: line 317


Any ideas to what im doing wrong?


Top
 Profile  
 
 Post subject: Re: problem executing oracle stored procedure
PostPosted: Mon Sep 27, 2010 12:12 pm 
Newbie

Joined: Wed Nov 25, 2009 3:12 am
Posts: 5
Hi the problem is calling the procedure

u can call to types

1. {call my_procs(?, :MYDBID)}
2. { ? = call my_procs( :MYDBID)}

? = return value
mybdid is input parm


i think it will help you.


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.