Recursive queries fail ---------------------- Key: IBATIS-407 URL: https://issues.apache.org/jira/browse/IBATIS-407 Project: iBatis for Java Issue Type: Bug Affects Versions: 2.3.0 Environment: Solaris 9, Oracle 10, Java, Spring/Struts Reporter: Craig Swift
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. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.