ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darek Dober" <doover...@op.pl>
Subject Avoiding N+1 selects
Date Sun, 03 Jul 2005 19:14:57 GMT
According to the documentation it is possible to ommit N+1 selects using

<resultMap id="get-product-result" class="com.ibatis.example.Product">
<result property="id" column="PRD_ID"/>
<result property="description" column="PRD_DESCRIPTION"/>
<result property="category.id" column="CAT_ID" />
<result property="category.description" column="CAT_DESCRIPTION" />

What if category has several attributes, I wouldn't like to recopy them to
other resultMap. Adding new attributes, requires
to place it in two or more resultMaps.
I would like just to reuse categoryMap from somewhere else.

Something like this on page 28 (resultMap):
<resultMap id="quarterMap" class="calendarQuarter" groupBy="quarter">
<result property="quarter" column="quarter"/>
<result property="name" column="name"/>
<result property="description" column="description"/>
<result property="months" resultMap="Calendar.monthMap"/>

But according to the documentation calendarQuarter is expected to have get
and set methods for months, as a List,
I would like to have only one month of class calendarMonth

Example mentioned above, throws exception: ClastCastException, I suppose it
expects months to be List, but I would like it to be one CalendarMap

Is it possible, to point down, that I want only one Bean, not the List?

Darek Dober

View raw message