[ http://issues.apache.org/jira/browse/IBATIS-136?page=all ]
     
Clinton Begin closed IBATIS-136:
--------------------------------

    Fix Version: 2.1.5
     Resolution: Fixed
      Assign To: Clinton Begin

Fixed.  Extended result maps now carry forward the groupBy attribute, and also 
allow it to be overridden.

> Unexpected interaction between "groupBy" and "extends" resultmap attributes
> ---------------------------------------------------------------------------
>
>          Key: IBATIS-136
>          URL: http://issues.apache.org/jira/browse/IBATIS-136
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: MS Windows XP Professional, JDK 1.3
>     Reporter: Geoff Chiang
>     Assignee: Clinton Begin
>     Priority: Minor
>      Fix For: 2.1.5

>
> If a resultmap extends another by means of the "extends" attribute, any 
> grouping information in the "base" resultmap is not correctly reflected in 
> any created objects when using the extended resultmap.
> Consider the following resultmaps:
> <resultMap id="communicationSearchResult" class="communication" 
> groupBy="communicationID">
>       <result property="communicationID" column="communication_id"/>
>       <result property="communicationDate" column="communication_date"/>
>       <result property="communicationType" column="communication_type_id" 
> typeHandler="communicationTypeTHC"/>
>       <result property="title" column="subject_1"/>
>       <result property="subject" column="subject_2"/>
>       <result property="customers" resultMap="Customer.customerResult"/>
> </resultMap>
> <resultMap id="communicationResult" class="communication" 
> extends="Communication.communicationSearchResult">
>       <result property="details" column="contact_detail" jdbcType="CLOB"/>
> </resultMap>
> Note the grouping on the "customers" attribute in the base resultmap.  
> Execution of a query which uses the "communicationResult" result map will 
> result in the "customers" attribute having a null value, despite the fact 
> that the query clearly returns the correct data.
> A workaround for this is to repeat the grouping information in the extended 
> resultmap, for example:
> <resultMap id="communicationResult" class="communication" 
> extends="Communication.communicationSearchResult" groupBy="communicationID">
>       <result property="details" column="contact_detail" jdbcType="CLOB"/>
>       <result property="customers" resultMap="Customer.customerResult"/>
> </resultMap>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to