http://stackoverflow.com/questions/6696389/nhibernate-accessing-the-sp-getting-errors-nhibernate-loader-loader-dolist

 

BL:

using (ISession Session = NHibernateSessionProvider.GetSession("MYDB"))
{
using (NHibernate.ITransaction Tran = Session.BeginTransaction(System.Data.IsolationLevel.Serializable))
{
IQuery query = (IQuery)Session.GetNamedQuery("MYSPNAME").SetResultTransformer(Transformers.AliasToBean(typeof(Sample))); ;
query.SetParameter("p_1", 1);
query.SetParameter("p_2", 12345678);
query.SetDateTime("p_3", null);

IList result = query.List();
}
}

 

Model :

[Serializable]
public class Sample : Entity
{
public virtual int Id { get; set; }
public virtual int SerialNumber { get; set; }

}

 

Mapping:

<?xml version=”1.0″ encoding=”utf-8″ ?>
<!– Generated by MoreGen 28-Apr-2008 11:27:28 –>
<hibernate-mapping xmlns=”urn:nhibernate-mapping-2.2″ assembly=”ASSEMBLYNAME”
namespace=”ASSEMBLYNAME.Entities”>
<class name=”Sample” table=”MYSPNAME” lazy=”true”>
<id name=”Id” column=”ID”>
<generator class=”native” />
</id>
<property name=”SerialNumber” column=”serial_number” />
<loader query-ref=”MYSPNAME”/>
</class>
<sql-query name=”MYSPNAME” >
<return alias=”MYSPNAME” class=”Sample”>
<return-property name=”SerialNumber” column=”serial_number” />
</return>

exec [OLTP_PACK.GET_SAMPLE_LIST]  :p_1 , :p_2 , :p_3

</sql-query>
</hibernate-mapping>

 

got an advise to try out this post http://devio.wordpress.com/2010/04/21/oracle-stored-procedures-with-nhibernate/
didn't work either..