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

Reply via email to