title: NHibernate get data from Stored Procedure through ref_cursor
body: <p>I'm also having trouble to get data from Stored Procedure through ref_cursor .
  Maybe you could advise how did you resolve that issue -</p>
  
  <p>My error :
  "ORA-06553: PLS-306: wrong number or types of arguments in call to 'GET_SAMPLE_LIST'"}
  I suppose The types of arguments in call is the problem</p>
  
  <p>Here is my code :</p>
  
  <p>HBM </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;!-- Generated by MoreGen 28-Apr-2008 11:27:28 --&gt;
  &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Infra"
                 namespace="Infra.Entities"&gt;
  
  &lt;class name="Sample" table="MY_PACK.Get_Sample_List" lazy="true"&gt;
  &lt;id name="Id" column="ID"&gt;
    &lt;generator class="native" /&gt;
  &lt;/id&gt;
  &lt;property name="Makat8" column="makat8" /&gt;
  &lt;property name="SerialNumber" column="serial_number" /&gt;
  
  &lt;loader query-ref="MY_PACK.Get_Sample_List"/&gt;
  &lt;/class&gt;
  &lt;sql-query name="MY_PACK.Get_Sample_List" callable="true" &gt;
  &lt;query-param name="p_crs" type="OracleDbType.RefCursor" /&gt;
  &lt;query-param name="p_1" type="int" /&gt;
  &lt;query-param name="p_2" type="string" /&gt;
  &lt;query-param name="p_3" type="int" /&gt;
  &lt;query-param name="p_4" type="date" /&gt;
  &lt;query-param name="p_5" type="date" /&gt;
  &lt;return alias="MY_PACK.Get_Sample_List" class="Sample"&gt;
    &lt;return-property name="Makat8" column="makat8" /&gt;
    &lt;return-property name="SerialNumber" column="serial_number" /&gt;
  
  &lt;/return&gt;
  call MY_PACK.Get_Sample_List  (:p_crs, :p_1 , :p_2 , :p_3 , :p_4 , :p_5)
  
  
  &lt;/sql-query&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>The SAmple entity :</p>
  
  <pre><code>public class Sample
  {
      public virtual int Id { get; set; }
      public virtual int Makat8 { get; set; }
      public virtual int SerialNumber { get; set; }
  }
  </code></pre>
  
  <p>Session configuration - it's Fluent but still the same :</p>
  
  <pre><code>       m_Factory  = Fluently.Configure()  //cfgRules
                .Database(OracleClientConfiguration.Oracle10.Dialect("NHibernate.Dialect.Oracle10gDialect")
             .ConnectionString(x =&gt; x.FromConnectionStringWithKey("MyDBCONNSTRING"))
               .Driver&lt;NHibernate.Driver.OracleDataClientDriver&gt;().ShowSql())
               .ExposeConfiguration(c =&gt; c.Properties.Add("hbm2ddl.keywords", "none"))
              .Mappings(m =&gt;
             {
                 m.FluentMappings.AddFromAssemblyOf&lt;MyEntityMapping&gt;();
                 m.HbmMappings.AddFromAssemblyOf&lt;MyHBMMapping&gt;();
                 m.MergeMappings();
             })
             .BuildConfiguration()
             .BuildSessionFactory();
  </code></pre>
  
  <p>There's the test :</p>
  
  <pre><code>using (ISession Session = NHibernateSessionProvider.GetSession("MyDBCONNSTRING"))
          {
              using (NHibernate.ITransaction Tran =    Session.BeginTransaction(System.Data.IsolationLevel.Serializable))
              {
                  IQuery query = (IQuery)Session.GetNamedQuery("MY_PACK.Get_Sample_List").SetResultTransformer(Transformers.AliasToBean(typeof(Sample))); ;
  
  
  
                  query.SetParameter("p_crs", OracleDbType.RefCursor);
                  query.SetParameter("p_1", 1);
                  query.SetParameter("p_2", 12345678);
                  query.SetParameter("p_3", 1);
                  query.SetDateTime("p_4", null);
                  query.SetDateTime("p_5", null);
  
  
  
  
                  IList result = query.List();
  
              }
          }
  </code></pre>
  
  <p>Any help will be appreceated! </p>