views:

7

answers:

0

Hi I'm executing a stored procedure with NHibernate. My mapping file is below. Fluent NHibernate for some reason is placing the Id column as the last parameter of the stored procedure. I need it to be the first parameter of the proc. You can see in the log how it is mapping the value 130 to parameter 23?

Anyone know if this is a bug or not or where I could post this question for further information?

Thanks

public class ContactMap: ClassMap { public ContactMap() {

       SqlInsert(
            "begin wc.pkg_crm_load.sp_load_crm_contact(:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11, :p12, :p13, :p14, :p15, :p16, :p17, :p18, :p19, :p20, :p21, :p22, :p23 ); end; ");
       Id(x => x.WCCustomerID);

        /* WCCustomerID = "130", 
            WCContactID = "990000333", 
            Street1 = "Magazine Group", 
            Street2 = "110 Fifth Avenue", 
            Street3 = null, 
            City = "New York", 
            State = "NY", 
            Country = "USA", 
            Zip = "10011", 
            Email = null, 
            Fax = null, 
            FirstName = "Mike", 
            JobTitle = "Test", 
            LastName = "Montemurro", 
            MobilePhone = null, 
            Status = "1", 
            BusinessPhone = "555-5555", 
            HomePhone = null,
            QwikLink = 0, 
            Billing = 1, 
            FreightBilling = 0, 
            ModifiedBy = "Mark Gellings" */



        Map(x => x.WCContactID);
        Map(x => x.Street1, "as_address_1");
        Map(x => x.Street2, "as_address_2");
        Map(x => x.Street3, "as_address_3");
        Map(x => x.City, "as_city");
        Map(x => x.State, "as_state");
        Map(x => x.Zip, "as_zip");
        Map(x => x.Country, "as_country");
        Map(x => x.FirstName, "as_first_name");
        Map(x => x.LastName, "as_last_name");
        Map(x => x.Position, "as_position");
        Map(x => x.BusinessPhone, "as_business_phone");
        Map(x => x.MobilePhone, "as_mobile_phone");
        Map(x => x.HomePhone, "as_home_phone");
        Map(x => x.Fax, "as_fax");
        Map(x => x.Email, "as_email_address");
        Map(x => x.Billing, "an_billing_contact_flag");
        Map(x => x.FreightBilling, "an_freight_bill_contact_flag");
        Map(x => x.QwikLink, "an_qwiklink_flag");
        Map(x => x.Status, "an_status_flag");
        Map(x => x.ModifiedBy, "as_row_updated_by");
        Map(x => x.ErrorCode, "an_error_code");
        Map(x => x.ErrorMsg, "as_error_message");

    }

[Test] public void can_call_the_contact_stored_procedure() { XmlConfigurator.Configure();

        var contact = new ContactDto() { 
            WCCustomerID = "130", 
            WCContactID = "990000333", 
            Street1 = "Magazine Group", 
            Street2 = "110 Fifth Avenue", 
            Street3 = null, 
            City = "New York", 
            State = "NY", 
            Country = "USA", 
            Zip = "10011", 
            Email = null, 
            Fax = null, 
            FirstName = "Mike", 
            JobTitle = "Test", 
            LastName = "Montemurro", 
            MobilePhone = null, 
            Status = 1, 
            BusinessPhone = "555-5555", 
            HomePhone = null,
            QwikLink = 0, 
            Billing = 1, 
            FreightBilling = 0, 
            ModifiedBy = "Mark Gellings",
           ErrorMsg = "null"}
        ;


        _session.Save(contact);
    }

2010-08-30 13:20:52,517 [7] [DEBUG] NHibernate.Persister.Entity.AbstractEntityPersister - Dehydrating entity: [Quad.MasterDatabase.CRMReplicationService.DataTransfer.ContactDto#130] 2010-08-30 13:20:52,532 [7] [DEBUG] NHibernate.Type.StringType - binding '990000333' to parameter: 0 2010-08-30 13:20:52,532 [7] [DEBUG] NHibernate.Type.StringType - binding 'Magazine Group' to parameter: 1 2010-08-30 13:20:52,548 [7] [DEBUG] NHibernate.Type.StringType - binding '110 Fifth Avenue' to parameter: 2 2010-08-30 13:20:52,564 [7] [DEBUG] NHibernate.Type.StringType - binding null to parameter: 3 2010-08-30 13:20:52,564 [7] [DEBUG] NHibernate.Type.StringType - binding 'New York' to parameter: 4 2010-08-30 13:20:52,579 [7] [DEBUG] NHibernate.Type.StringType - binding 'NY' to parameter: 5 2010-08-30 13:20:52,579 [7] [DEBUG] NHibernate.Type.StringType - binding '10011' to parameter: 6 2010-08-30 13:20:52,595 [7] [DEBUG] NHibernate.Type.StringType - binding 'USA' to parameter: 7 2010-08-30 13:20:52,595 [7] [DEBUG] NHibernate.Type.StringType - binding 'Mike' to parameter: 8 2010-08-30 13:20:52,610 [7] [DEBUG] NHibernate.Type.StringType - binding 'Montemurro' to parameter: 9 2010-08-30 13:20:52,626 [7] [DEBUG] NHibernate.Type.StringType - binding null to parameter: 10 2010-08-30 13:20:52,626 [7] [DEBUG] NHibernate.Type.StringType - binding '555-5555' to parameter: 11 2010-08-30 13:20:52,642 [7] [DEBUG] NHibernate.Type.StringType - binding null to parameter: 12 2010-08-30 13:20:52,642 [7] [DEBUG] NHibernate.Type.StringType - binding null to parameter: 13 2010-08-30 13:20:52,657 [7] [DEBUG] NHibernate.Type.StringType - binding null to parameter: 14 2010-08-30 13:20:52,657 [7] [DEBUG] NHibernate.Type.StringType - binding null to parameter: 15 2010-08-30 13:20:52,673 [7] [DEBUG] NHibernate.Type.Int32Type - binding '1' to parameter: 16 2010-08-30 13:20:52,673 [7] [DEBUG] NHibernate.Type.Int32Type - binding '0' to parameter: 17 2010-08-30 13:20:52,689 [7] [DEBUG] NHibernate.Type.Int32Type - binding '0' to parameter: 18 2010-08-30 13:20:52,689 [7] [DEBUG] NHibernate.Type.Int32Type - binding '1' to parameter: 19 2010-08-30 13:20:52,704 [7] [DEBUG] NHibernate.Type.StringType - binding 'Mark Gellings' to parameter: 20 2010-08-30 13:20:52,720 [7] [DEBUG] NHibernate.Type.Int32Type - binding null to parameter: 21 2010-08-30 13:20:52,720 [7] [DEBUG] NHibernate.Type.StringType - binding 'null' to parameter: 22 2010-08-30 13:20:52,735 [7] [DEBUG] NHibernate.Type.StringType - binding '130' to parameter: 23 2010-08-30 13:20:52,751 [7] [DEBUG] NHibernate.SQL - begin wc.pkg_crm_load.sp_load_crm_contact(:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11, :p12, :p13, :p14, :p15, :p16, :p17, :p18, :p19, :p20, :p21, :p22, :p23 ); end;:p0 = '990000333', :p1 = 'Magazine Group', :p2 = '110 Fifth Avenue', :p3 = NULL, :p4 = 'New York', :p5 = 'NY', :p6 = '10011', :p7 = 'USA', :p8 = 'Mike', :p9 = 'Montemurro', :p10 = NULL, :p11 = '555-5555', :p12 = NULL, :p13 = NULL, :p14 = NULL, :p15 = NULL, :p16 = 1, :p17 = 0, :p18 = 0, :p19 = 1, :p20 = 'Mark Gellings', :p21 = NULL, :p22 = 'null', :p23 = '130' NHibernate: begin wc.pkg_crm_load.sp_load_crm_contact(:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11, :p12, :p13, :p14, :p15, :p16, :p17, :p18, :p19, :p20, :p21, :p22, :p23 ); end;:p0 = '990000333', :p1 = 'Magazine Group', :p2 = '110 Fifth Avenue', :p3 = NULL, :p4 = 'New York', :p5 = 'NY', :p6 = '10011', :p7 = 'USA', :p8 = 'Mike', :p9 = 'Montemurro', :p10 = NULL, :p11 = '555-5555', :p12 = NULL, :p13 = NULL, :p14 = NULL, :p15 = NULL, :p16 = 1, :p17 = 0, :p18 = 0, :p19 = 1, :p20 = 'Mark Gellings', :p21 = NULL, :p22 = 'null', :p23 = '130'

related questions