ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Recommended practice / nested ResultMaps
Date Wed, 25 May 2005 04:41:24 GMT
When you say "neither worked properly", what do you mean? Did you get an 
exception? Or did you just get unexpected results?

Did you override both equals() and hashCode() for the complex property type? 
As per the standard? Here's a description of how to override them properly: 
http://www.geocities.com/technofundo/tech/java/equalhash.html

Cheers,
Clinton


On 5/23/05, Karen Koch <kmkoch@sbcglobal.net> wrote:
> 
> Given the following nested resultMap configuration with the child 
> resultMap including a complex property that is part of the groupBy, how 
> should the groupBy on that property be specified? I tried using the complex 
> property name, and I tried qualifying the complex property name with the 
> simple key-value sub-property -- neither worked properly.
>  <resultMap id="distUsagesResult" class="distUsages" groupBy="distKey, 
> entryDate">
> <result property="distKey" column="DistKey"/>
> <result property="entryDate" column="Date"/>
> <result property="org" column="Org"/>
> <result property="costCtr" column="CostCtr"/>
> <result property="task" column="Task"/>
> <result property="option" column="Option"/>
> <result property="statisticList" resultMap="StatType.statisticResult"/> 
>  </resultMap>
>   <resultMap id="statisticResult" class="statistic" groupBy="distKey, 
> entryDate, statType"> 
> <!-- also tried <resultMap id="statisticResult" class="statistic" 
> groupBy="distKey, entryDate, statType.statTypeKey"> -->
> <result property="distKey" column="StatDistKey"/>
> <result property="entryDate" column="StatEntryDate"/>
> <result property="statType" column="StatTypeKey" select="getStatType"/>
> <result property="numUnits" column="StatNumUnits"/>
> </resultMap>
>  <resultMap id="statTypeResult" class="statType">
> <result property="statTypeKey" column="StatTypeKey"/>
> <result property="statTypeID" column="StatTypeID"/>
> <result property="statTypeDesc" column="StatTypeDesc"/>
> <result property="measUnits" column="MeasUnits"/>
> <result property="numDecPlaces" column="NumDecPlaces"/>
> <result property="org" column="Org"/>
> <result property="account" column="Account"/>
> <result property="costCtr" column="CostCtr"/>
> <result property="task" column="Task"/>
> <result property="option" column="Option"/>
> </resultMap>
>  Thanks thanks thanks!
>  Karen
>

Mime
View raw message