ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikael Andersson" <mail.mi...@gmail.com>
Subject Re: Semi complex mapping question
Date Wed, 21 Mar 2007 18:04:59 GMT
Hi,
I had a bit of a breakthrough :)

Ditched the subselect; started experimenting with using resultMap and
groupBy instead of select attribute and got it working.

Important change (for new users):

<resultMap id="CurveBOResult" class=" test.bo.CurveBO"
groupBy="curveName,curveCategory">
    <result column="CURVE_NAME" jdbcType="CHAR" property="curveName"/>
   <result column="CURVE_CATEGORY" jdbcType="CHAR"
property="curveCategory"/>
    <result property="curvePoints" resultMap="getCurvePoints"/>
 </resultMap>


I assume this is the preferred way of doing things as well, so I'm happy.

Thanks,
 Mike


On 21/03/07, Ted Schrader <teds.mailing.lists@gmail.com> wrote:
>
> Hi Mike,
>
> I see where you found the composite key syntax in the Developer's
> Guide ("Composite Keys or Multiple Complex Parameters Properties").
>
> The guide does make it sound like the values are being passed in to
> the nested select.  I've run out of ideas.
>
> However, when you get this approach working, this will not avoid N+1
> selects from being executed; iBATIS will simply execute them for you
> with a single invocation of queryForXXXX().
>
>
> To the list: the guide also gives the impression that the composite
> key syntax can only be used with nested statements and not with the
> "groupBy" attribute.  Is this true?
>
> Thanks,
>
> Ted
>

Mime
View raw message