nHibernate seems to not catch this functionality of a sproc.
But it does expect/require a recordset.
This is what I do in all update query mappings:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true"
assembly="TKOSMERP" namespace="TKOSMERP.Models">
<sql-query name="CustomersUpdate" callable="true" >
<query-param name="recid" type="System.Int32"/>
<query-param name="CustomerName" type="System.String"/>
<return-scalar column ="ret" type ="System.String"/> <!-- because for
some reason every proc returns a recordset as far as nHibernate is
concerned-->
exec CustomersUpdate
@recid=:recid
, @CustomerName=:CustomerName
</sql-query>
</hibernate-mapping>
And all my procs end in:
select <value> as 'ret'
in most cases
select 'okay' as 'ret'
Hope this helps to know.
On Tuesday, March 22, 2016 at 10:35:42 AM UTC-4, Masood Rahman wrote:
>
> I am not getting return value, which stored procedure is returning. The sp
> is returning int. In nhibernate, when i check the iquery.list()[0]; The
> error message is given " list Index was out of range. Must be non-negative
> and less than the size of the collection. nParameter name: index". What is
> the issue? I am returning like this "return 1" for commit and for rollback
> "return -1" .
>
> Masood
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.