ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dorin Manoli" <Dorin.Man...@dataireland.ie>
Subject RE: QueryForObject bug ?
Date Thu, 16 Nov 2006 15:28:55 GMT
Sorry I forgot to attach;



From: Dorin Manoli [mailto:Dorin.Manoli@dataireland.ie] 
Sent: Thursday, November 16, 2006 2:59 PM
To: user-cs@ibatis.apache.org
Subject: QueryForObject bug ?


Hi people, I stuck with a problem for a few hours till I figured out
that it may be a iBatis Error..


Steps to reproduce. I have a Table with data (see atach)


I have the xml maped statements

<select id="GetCompanyById" resultMap="CompaniesResultMap"

                  select companyId,serial,regNo,regDate,legalFormId,


printOptions,member,mail,indica,journl,comptr,isLocked,      replyCodeId
from companies

                  <isGreaterThan property ="CompanyId" compareValue

                              where companyId = #CompanyId#


                  order by companyId


....... ....

Then I wrote a mapped class... with a method

public Company GetCompanyById(long companyId)


                  Company cp = new Company();




                        Hashtable queryParams = new Hashtable();

                        queryParams.Add("CompanyId", companyId);


                        cp =








                  return cp;


Unit test to invoke this metnod:


            public void GetWrongCompanyById()


                  CompaniesMap companyMap = new CompaniesMap();

                  //Company getCompany = new Company();


                  Company company=companyMap.GetCompanyById(-1);




Unit test result is : 

KompassDataLayer.Test.CompaniesTest.GetWrongCompanyById : 

      expected: <0>

       but was: <29>


so I was expected a null value instead of first record from the table .


VS watch :  cp

      BussOverseas      0     int

      bussOverseas      0     int

      changed     false bool

      Changed     false bool

      CompanyId   29    long

      companyId   29    long

      Comptr      null  string

      comptr      null  string

      emploees    100   int

      Indica      "MSE" string

      indica      "MSE" string

      isLocked    false bool

      Journl      "60"  string

      journl      "60"  string

      legalFormId 0     int

      LegalFormId 0     int

      Locked      false bool

      mail  "D"   string

      Mail  "D"   string

      Member      "2 D" string

      member      "2 D" string

      NoEmpl      100   int

      OfficeHr    "M-Fr: 9.00-17.00"      string

      officeHr    "M-Fr: 9.00-17.00"      string

      Origin      "IE"  string

      originCountry     "IE"  string

      printOptions      "1P"  string

      Prtopt      "1P"  string

      RegDate     "2001"      string

      regDate     "2001"      string

      regNo "123456N"   string

      RegNo "123456N"   string

      ReplyCodeId 0     int

      replyCodeId 0     int

      Serial      "70950520"  string

      serial      "70950520"  string

      vatno ""    string

      VatNo ""    string




View raw message