While calling SQL Server stored procedure from NHibernate can I pass list or custom data type as a parameter -


i tested oracle. working fine. because there have package , defined associative array type , stored procedure in package body.

though there no concept of packages in sql server. how make work in sql server?

domain object start

[serializable] public class employee {     public virtual int employeeid     {         get;         set;     }     public virtual string employeepassword     {         get;         set;     }      public virtual string employeename     {         get;         set;     }      public virtual int teamassociatedwith     {         get;         set;     }     public virtual string iscaptain     {         get;         set;     }     public virtual int numberofmom     {         get;         set;     }     public virtual int balance     {         get;         set;     }        } 

mapping

<?xml version="1.0" encoding="utf-8" ?>    <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">      <class name="domainobject.employee,domainobject" table="employee">      <id name="employeeid" column="emp_id" type="int" unsaved-value="0">        <generator class="native">               </generator>      </id>      <property name="employeepassword" column="emp_password" type="string"/>      <property name="employeename" column="emp_name" type="string"/>        <property name="teamassociatedwith" column="team_associated_with" type="int"/>      <property name="iscaptain" column="is_captain" type="string"/>      <property name="balance" column="balance" type="int"/>      <property name="numberofmom" column="no_of_mom" type="int"/>    </class>   </hibernate-mapping>   

stored procedure

create procedure [dbo].[some_sp] @id inttable readonly      select emp_id,emp_name,emp_password, team_associated_with,is_captain,no_of_mom,balance  employee;  go 

isqlquery final = eventhistorysession.createsqlquery("exec testcustom @location = :id");
iquery result = final.setstructured("id", dt);
ilist finalresult = result.list();

in sql server, stored procedures can have parameters of type table can used mimic oracle associative array feature. in situation, you'd sending "table" single row , multiple columns. there a example nhibernate here in accepted answer.


Comments