ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Minjae Kim" <con...@gmail.com>
Subject Avoiding N+1 Selects(1:M and M:N) with iBATIS version 2.1.7
Date Thu, 09 Nov 2006 02:51:30 GMT
I read the explanation about Avoiding N+1 Selects(1:M and M:N) with
2.2.0, but the version I am using now is 2.1.7.

Is there way I can do this job like 2.2.0 by using 2.1.7? Make sense?
English is not my native language, so please understand me. ^___^

<sqlMap namespace="ProductCategory">
...
<resultMap id="categoryResult" class="com.ibatis.example.Category" groupBy="id">
    <result property="id" column="CAT_ID"/>
    <result property="description" column="CAT_DESCRIPTION"/>
<result property="productList" resultMap="ProductCategory.productResult"/>
</resultMap>

<resultMap id="productResult" class="com.ibatis.example.Product">
    <result property="id" column="PRD_ID"/>
    <result property="description" column="PRD_DESCRIPTION"/>
</resultMap>

<select id="getCategory" parameterClass="int" resultMap="categoryResult">
    select C.CAT_ID, C.CAT_DESCRIPTION, P.PRD_ID, P.PRD_DESCRIPTION
    from CATEGORY C
    left outer join PRODUCT P
    on C.CAT_ID = P.PRD_CAT_ID
    where CAT_ID = #value#
</select>
...
</sqlMap>

The solution above is applied with only 2.2.0, right?
How about 2.1.7? This is my question.

Thanks in advance..
Awaiting your reply soon..

Best,
Minjae

Mime
View raw message