You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Walter So (JIRA)" <ib...@incubator.apache.org> on 2004/11/20 23:11:24 UTC

[jira] Created: (IBATIS-16) returned Objects uninitiallized in ResultMap extends

returned Objects uninitiallized in ResultMap extends
----------------------------------------------------

         Key: IBATIS-16
         URL: http://nagoya.apache.org/jira/browse/IBATIS-16
     Project: iBatis for Java
        Type: Bug
  Components: SQL Maps  
 Environment: iBatis 2.0.5.399
    Reporter: Walter So
    Priority: Minor


To duplicate this bug, you need two resultmaps:

    <resultMap id="a" class="Parent">
        <result property="id"        column="RELM_ID"       />
        <result property="amount"    column="AMT" />
        <result property="update"    column="UPDATE"       />
 	</resultMap>

    <resultMap id="b" class="Child" extends="a">
        <result property="from"    column="FROM" />
        <result property="to"      column="TO"   />
    </resultMap>

And two queries:

    <select id="getAll" resultMap="a"  >
        select ID, AMT, UPDATE
        from TABLEA
    </select>

    <select id="getSome" parameterClass="string" resultMap="b" >
        select ID, AMT, FROM, TO
        from TABLEB
        where ID like #value# 
    </select>

The problem is when get sql.queryForList("getSome", id) gets executed, iBatis doesn't throw an error, but returns a collection of uninitialized Child objects.  After scrutiny, I learned it was because the column "UPDATE" was omitted from the query.  Normally, iBatis will throw an Exception if not all the properties are mapped.  In this case, it does not complain when a resultMap is an extension of another.

I was able to diagnose this problem by rewriting the "b" resultMap without "extends".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Closed: (IBATIS-16) returned Objects uninitiallized in ResultMap extends

Posted by "Clinton Begin (JIRA)" <ib...@incubator.apache.org>.
     [ http://nagoya.apache.org/jira/browse/IBATIS-16?page=history ]
     
Clinton Begin closed IBATIS-16:
-------------------------------

      Assign To: Clinton Begin
     Resolution: Cannot Reproduce
    Fix Version: 2.0.8


Could not recreate this problem using the exact test case provided.  It might be a problem specific to a driver.

> returned Objects uninitiallized in ResultMap extends
> ----------------------------------------------------
>
>          Key: IBATIS-16
>          URL: http://nagoya.apache.org/jira/browse/IBATIS-16
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>  Environment: iBatis 2.0.5.399
>     Reporter: Walter So
>     Assignee: Clinton Begin
>     Priority: Minor
>      Fix For: 2.0.8

>
> To duplicate this bug, you need two resultmaps:
>     <resultMap id="a" class="Parent">
>         <result property="id"        column="RELM_ID"       />
>         <result property="amount"    column="AMT" />
>         <result property="update"    column="UPDATE"       />
>  	</resultMap>
>     <resultMap id="b" class="Child" extends="a">
>         <result property="from"    column="FROM" />
>         <result property="to"      column="TO"   />
>     </resultMap>
> And two queries:
>     <select id="getAll" resultMap="a"  >
>         select ID, AMT, UPDATE
>         from TABLEA
>     </select>
>     <select id="getSome" parameterClass="string" resultMap="b" >
>         select ID, AMT, FROM, TO
>         from TABLEB
>         where ID like #value# 
>     </select>
> The problem is when get sql.queryForList("getSome", id) gets executed, iBatis doesn't throw an error, but returns a collection of uninitialized Child objects.  After scrutiny, I learned it was because the column "UPDATE" was omitted from the query.  Normally, iBatis will throw an Exception if not all the properties are mapped.  In this case, it does not complain when a resultMap is an extension of another.
> I was able to diagnose this problem by rewriting the "b" resultMap without "extends".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira