ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Hansknecht <DougFromO...@us.ibm.com>
Subject Child object created when no child records exist in table
Date Tue, 15 Jul 2008 19:31:37 GMT
It appears that ABATIS-213 has surfaced again. 

Scenario: 
        Two tables (Household, Person) are tied (Person has HouseholdID) 

The result maps: 
 <resultMap id="HouseholdResult" class="Household" groupBy="HouseholdID"> 
  <result property="HouseholdID" column="HouseholdID"/> 
  <result property="Address" column="Address" /> 
  <result property="People" resultMap="Person.PersonResult" /> 
 </resultMap> 

  <resultMap id="PersonResult" class="Person"> 
    <result property="PersonID" column="PersonID" nullValue="-1"/> 
    <result property="Name" column="Name"/> 
    <result property="SSN" column="SSN" nullValue="-1"/> 
    <result property="HouseholdID" column="HouseholdID" nullValue="-1"/> 
  </resultMap> 

when a select is executed that returns a household record with no person 
records, the Household Java object has 1 child object with the following 
values: 
        PersonID        -1 
        Name                null 
        SSN                null 
        HouseholdID        -1 

I am using ibatis-2.3.2.715.jar 


Douglas Hansknecht
IT Architect, Portals, Content & e-Commerce
IBM Global Business Services
Phone: 614-582-9886 Fax: 614-559-4574
DougFromOhio@us.ibm.com
Mime
View raw message