Craig actually works with me and I have seen this issue first hand. Any one else tried to do this?
On 3/8/07, Craig Swift <[EMAIL PROTECTED]> wrote:
Hello,
I wanted to report a potential bug in the latest release of IBATIS. This
issue only appeared after performing a recent upgrade to the latest jar,
i.e. everything used to work. :) I'll do my best to try and explain it
over email - although it's a little confusing.
I have the two following tables (simplified):
RC_AWARD:
ID NUMBER(10)
NAME VARCHAR2(50)
Primary Key: ID
RC_AWARD_DEPENDENCIES:
DEPENDENT_AWARD_ID NUMBER(10)
DEPENDENCY_AWARD_ID NUMBER(10)
Primary Key: DEPENDENT_AWARD_ID, DEPENDENCY_AWARD_ID
There are six rows in the RC_AWARD table, and five rows in the
RC_AWARD_DEPENDENCIES
table, with basically one award be dependent on the other 5.
------------------------------------
My SQL Map looks like the following:
<sqlMap namespace="Award">
<resultMap id="awardResultMap" class="Award">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="dependencies" column="id" select="
Award.getDependentAwards" />
</resultMap>
<select id="getAward" parameterClass="string"
resultMap="awardResultMap">
select * from RC_AWARD where ID = #value#
</select>
<select id="getDependentAwards" parameterClass="string"
resultMap="awardResultMap">
select
a.*
from
RC_AWARD a, RC_AWARD_DEPENDENCIES b
where
a.ID = b.DEPENDENCY_AWARD and
b.DEPENDENT_AWARD = #value#
order by a.NAME
</select>
</sqlMap>
------------------------------------
Finally the Award class is a simple bean where id and name are strings and
dependencies is a List<Award>.
------------------------------------
Ok, so there's the setup. ;) What used to happen is when I would call
"getAward" I'd get a single award object with my five award dependencies
populated in the object.
public Award getAward(String id) {
return awardDao.getAward(id);;
}
Now for what ever reason I only get the first dependency and not the other
four. If I run the queries seperately, something similar to this:
public Award getAward(String id) {
Award award = awardDao.getAward(id);
award.setDependencies(awardDao.getDependentAwards(id));
return award;
}
Everything is fine again. If it helps we went from version 2 (I think,
about 1 & 1/2 years old) to 2.3. This small tool is supposed to be our
"test" project before we upgrade one of our larger projects, so I'd really
like to figure out if it's an IBATIS issue or not. The larger project has
tons of these recursive type calls. Thanks in advance for the help.
--
* Craig J. Swift
Sun Microsystems Inc.
Software Program Manager
* Phone: 303-272-9944
Internal Ext: 79944
Email: [EMAIL PROTECTED]
***Sun Confidential**:* This message including any attachments is
confidential information of Sun Microsystems Inc. Disclosure, copying, or
distribution is prohibited without permission of Sun. If you are not the
intended recipient, please reply to the sender and then delete this message.
<<attachment: sig-image-1.jpg>>
