Hi, I have question about how iBatis decides what query result value to
load into a resultmap's property. Specically, the following query will
produce a correctly constructed resultmap class with 'apples' usr_id set
to a non-null value
select b*,c*,a*
from apple a, banana b
LEFT OUTER JOIN candy c on (c.usr_id = a.usr_id)
blah blah
when the result for the outer join does not return a row for candy,
while the following query will set apples usr_id to null when the
same condition applies i.e. no row return for candy by the out join
select a.*, b.*, c*
from apple a, banana b
LEFT OUTER JOIN candy c on (c.usr_id=a.usr_id)
I suspect that iBatis is over writing the apple objects usr_id because
the column names for the two tables are map to the same property name,
and iBatis is just using the last seen value in the resultset to
populate the value of apple regardless if the value actually came from a
apple row.
Is this a bug?
I have tested this with iBatis 2.3.0.677 and 2.2.0.638 using postgresql
driver 8.2-504.jdbc3.jar and jdk1.6.0, both iBatis versions behave the
same.