Overwriding property in result
------------------------------

                 Key: IBATIS-604
                 URL: https://issues.apache.org/jira/browse/IBATIS-604
             Project: iBatis for Java
          Issue Type: Bug
          Components: SQL Maps
    Affects Versions: 2.3.0
         Environment: Not significant
            Reporter: Emilio Gutiérrez León
            Priority: Minor


Hello.

I need to set the value of all properties of "Address" of the person in each 
job :

<resultMap id="JobPersonMapping" class="JobPerson">                
      <result property="job" resultMap="Jobs.JobMapping"/>       
      <result property="person" resultMap="Person.PersonMapping" />
      <result property="person.Address" select="Address.Addrees_find" 
column="{id=PERSON.PERSON_ADDRESS_IDINT}" />
</resultMap>

<select id="JobPerson_find" parameterClass="JobPerson" 
resultMap="JobPersonMapping">
         SELECT *
          FROM JOB,
                  JOB_PERSON,
                  PERSON
         WHERE JOB_PERSON.PERSON_IDINT = PERSON.IDINT
             AND JOB_PERSON.JOB_IDINT = JOB_IDINT
             AND JOB_PERSON.IDINT = #id#
 </select>

<resultMap id="PersonMapping" class="Person">   
      <result property="id" column="PERSON_IDINT" />
      <result property="address.id" column="PERSON_ADDRESS_IDINT" />
      ...   
</resultMap>

<resultMap id="JobMapping" class="Job">   
      <result property="id" column="JOB_IDINT" />
      ...   
</resultMap>

<!-- ADDRESS map config file !-->
<select id="Address_find" parameterClass="Address" resultMap="AddreessMapping">
        SELECT *                      
          FROM ADDRESS
         WHERE ADDRESS_IDINT = #id#
</select>

<resultMap id="AdreessMapping" class="Address">
      <result property="id" column="ADD_IDINT" />
      <result property="street" column="ADD_STREET" />
      ...
</resultMap>

The problem is that "person.Address" only have completed the property "id" 
because in the process I believe that first Ibatis set "person.Address" 
correctly with the result of "Address.AddreessMapping" and later overwrite the 
property "person.Address" with the result of resultmap "Person.PersonMapping". 
The objetive of this is reuse the sql sentences.

Thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to