As far as I know you can not do this the way you would think.

I am sure it could be done with two result maps, one for each arm.

Second part is that you will not be able to use .* notation.  You will have to alias the column.

On Fri, May 9, 2008 at 7:29 AM, steve mcdowell <steven.mcdowell@pcmsgroup.com> wrote:

I have, for example, two tables PERSON, ARM.  Lets say that, amongst other
things, PERSON has two columns LEFT_ID and RIGHT_ID, which are references
into the primary key for the ARM table.

My best (wrong) guess is to write something like this:


class Person {
 ...
 Arm left;
 Arm right;
}


<resultMap id="person" class="Person">
 ...
 <result property="left"     resultMap="Stuff.arm"/>
 <result property="right"    resultMap="Stuff.arm"/>
 ...
</resultMap>


<resultMap id="arm" class="Arm">
 ...
</resultMap>


<select id="get" resultMap="person">
 SELECT
   p.*, left.*, right.*
 FROM
   PERSON p
   LEFT JOIN ARM left ON (p.LEFT_ID = left.id)
   LEFT JOIN ARM right ON (p.RIGHT_ID = right.id)
</select>


This doesn't seem to work, probably because I am not specifying that the
properties should use the respective SQL alias.  It seems that both arms are
ending up as right arms, or whichever is retrieved last in the SQL.

Unfortunately, I can see no way of solving this in the documentation.  Am I
missing something / taking the wrong approach?
--
View this message in context: http://www.nabble.com/Problem-if-two-properties-have-same-type-tp17147953p17147953.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.