Hi All,
I am trying to call stor-proc using NHibernate, but I alway got exception
"Named query not known: spGetItemDetail"; type NHibernate.MappingException
Here are what I got:
ItemDetail.hbn.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="MyApplication.Common"
namespace="MyApplication.Common.Domain">
<sql-query name="spGetItemDetail">
<return class="ItemDetail">
<return-property column="ItemID" name="ItemID"/>
<return-property column="Number" name="Number">
</return>
exec dbo.spGetItemDetail :ItemId
</sql-query>
</hibernate-mapping>
Class ItemDetail.cs
namespace MyApplication.Common.Domain
{
public class ItemDetail
{
public int ItemID {get; set;}
public int Number {get; set;}
}
}
Calling Stor-Proc
IQuery query = _session.GetNamedQuery("spGetItemDetail"); //Here is
where I got the exception
query.SetInt32("ItemId", 13);
return query.List<ItemDetail>();
I am so frustrated to get it working, please help.
.Tola.