Hello,

I hope I can find help here.

I have to load a list of entities (Carrier) using a MSSQL 2005 stored
procedure call.
When I call the stored procedure from my management studio, I get the
data I need, BUT calling the same using the code below returns an
empty list.

I have been on this for half a day and googled a lot. I don't seem to
see where I am going wrong.
Any help?

Thanks.


===================================== C#
Code====================================
using (ISession session = SessionFactory.OpenSession()){

                IQuery query =
session.GetNamedQuery("GetCarrierByCountryAndProtocol_SP");
                query.SetString("CountryID",
string.Format("'{0}'",country));
                query.SetInt64("ProtocoltypeID", protocol);
                query.SetResultTransformer(myResultTransformer);
                return query.List<Carrier>();
}

=====================================Mapping=====================================
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="VoxService.Entities" namespace="VoxService.Entities" default-
lazy="false" schema="Carrier">
  <class name="Carrier" table="Carrier">
    <id name="EntityID" column="Entity_ID" type="Int64">
      <generator class="native"/>
    </id>
    <property name="VersionID" column="Entity_Version_ID"/>
    <property name="Name" column="Name" not-null="true"/>
    <property name="ShortName" column="Short_Name" not-null="false"/>
  </class>


  <sql-query name="GetCarrierByCountryAndProtocol_SP" callable="true">
    <return alias="carriers" class="VoxService.Entities.Carrier,
VoxService.Entities">
      <return-property name="EntityID" column="Carrier_ID"/>
      <return-property name="Name" column="Carrier_Name"/>
      <return-property name="ShortName" column="Carrier_ShortName"/>
      <return-property name="VersionID" column="Carrier_Version_ID"/>
    </return>
    EXEC [dbo].
[GetAllCarrierByCountryID_New] :CountryID, :ProtocoltypeID
  </sql-query>

</hibernate-mapping>
======================================Stored Procedure
=============================
ALTER PROCEDURE [dbo].[GetAllCarrierByCountryID_New]
-- Basis [dbo].[GetAllCarrierByCountryID_New]
        -- Add the parameters for the stored procedure here
@CountryID [char](2),
@ProtocoltypeID [bigint] = NULL

...

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to