ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steve mcdowell <steven.mcdow...@pcmsgroup.com>
Subject Problem if two properties have same type
Date Fri, 09 May 2008 13:29:03 GMT

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 id="arm" class="Arm">

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

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.

View raw message