ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-225) Reuse resultmap for single bean property
Date Thu, 08 Jun 2006 21:06:34 GMT
    [ http://issues.apache.org/jira/browse/IBATIS-225?page=comments#action_12415427 ] 

Jeff Butler commented on IBATIS-225:

I propose to fix this using Paul's last suggestion - meaning that if the specified property
is not a collection, then we'll just create and populate the value.  We'll still use the resultMap
attribute, but we'll interpret it differently depending on whether the specified property
is a Collection or not.  This will make it possible to reuse result maps for 1:1 mappings.

I've done some testing of my proposed fix with and without the groupBy attribute specified
and I'm getting the results I expect in each case.

BTW - resultMap really does what it means - it reuses a resultMap.  There was just an assumption
that resultMap would only be used in conjunction with groupBy and that the property would
always be some kind of collection.  This fix will remove that assumption.

A good side effect of this fix is that you will be able to provide custom List, Set, or Collection
implementations through the result object factory if you so desire (this has come up recently
on the user list).

> Reuse resultmap for single bean property
> ----------------------------------------
>          Key: IBATIS-225
>          URL: http://issues.apache.org/jira/browse/IBATIS-225
>      Project: iBatis for Java
>         Type: Improvement

>   Components: SQL Maps
>     Reporter: Huy Do
>     Assignee: Jeff Butler

> Allow the following reuse of result maps
> <resultMap id="Pick" class="package.domain.Pick">
>   <result property="pickId" column="pick_id"/>
>    <result property="sale" resultMap="Sale"/>
> </resultMap>
> <resultMap id="Sale" class="Sale">
>    <result column="sale_id" property="saleId"/>
> </resultMap>
> with beans
> class Pick {
>       String pickId;
>       Sale sale;
> }
> class Sale {
>       String saleId;
> }
> At the moment <result property="sale" resultMap="Sale"/> can only be reused if
property "sale" is a collection.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message