Hello All,

 

I am using Microsoft .Net platform and ORM as Nhibernate. I am implementing 
a functionality using stored procedure which returns multiple result sets, 
for example one set is related with employee list and another one is total 
count but as limitation of the Nhibernate it was providing always first 
result.

 

I did research but not got the solid solution, few URL’s are mentioned 
below,

https://groups.google.com/forum/#!topic/nhusers/MUtSUZjAnz0

http://azilana-programmernotes.blogspot.com/2015/05/nhibernate-cannot-handle-multiple.html

https://stackoverflow.com/questions/3069865/nhibernate-multiple-recordsets-from-stored-procedure

 

I wanted to implement using single stored procedure which returns a 
multiple result set and handles in *hbm.xml mapping file. Please let me 
know if someone has solid solution for the problem statement that would be 
appreciated.

 

*Scenario:*

 

*DB:*

create PROCEDURE [dbo].[usp_get_employee]

AS

BEGIN  

       SET NOCOUNT ON;   

       SELECT 

              Name,

              Designation

       From Employee with(nolock);

 

       select count(1) AS TotalRows from Employee with(nolock);

END

 

*Hibernate XML Mapping File (What is other settings need to be added)*

 

<?xml version="1.0" encoding="utf-8" ?>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">

  <sql-query name="GetEmployee" callable ="true">

    EXEC [dbo].[usp_get_employee]

  </sql-query>

</hibernate-mapping>

 

Please let me know your inputs.

 

Thanks & Regards,

Ravi

-- 
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.

Reply via email to