Unexpected results in both cases -- in the case of the complex property, equivalence wasn't determined when it "should" have been. (Actually, now that you bring up the necessity of overriding equals() and hashCode(), I see exactly why it didn't work for the complex property -- I only implemented the Comparable interface (requires only compareTo() to be overridden).)
But I guess I still was surprised I couldn't dereference the key value of the complex property via the dot notation... I ended up having to add that key value to the statisticResult resultMap and POJO to get it to work properly, which works, but is not elegant, per se... is there a bug there, or did I use the wrong syntax somehow, or...? Karen --- Clinton Begin <[EMAIL PROTECTED]> wrote: > 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 <[EMAIL PROTECTED]> 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 > > >