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.
_________________________________________________________________
Descubre todas las formas en que puedes estar en contacto con amigos y
familiares.
http://www.microsoft.com/windows/windowslive/default.aspx