You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Minjae Kim <co...@gmail.com> on 2006/11/09 03:51:30 UTC
Avoiding N+1 Selects(1:M and M:N) with iBATIS version 2.1.7
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
Re: Avoiding N+1 Selects(1:M and M:N) with iBATIS version 2.1.7
Posted by Minjae Kim <co...@gmail.com>.
Do you mean I can reuse resultMap(which is namespace aware) and
groupBy not only with 2.2.0 but also 2.1.7?
Best,
Minjae
2006/11/9, proge.allievi@daimlerchrysler.com
<pr...@daimlerchrysler.com>:
> Yes, you can use it.
>
> try
>
> Cordiali saluti/Kind Regards.
>
> Alessandro Allievi
>
> (Embedded image moved to file: pic11091.gif)
> www.progesoftware.it
> Via Mentore Maggini, 48/50
> 00143 Roma
> Phone +39 06.5042621
> Fax +39 06.5042676
> mailto: aallievi@progesoftware.it
>
>
>
> conkmj@gmail.com
>
> 09/11/2006 03.51 To
> user-java@ibatis.apache.org
> cc
> Please respond to
> user-java@ibatis. Subject
> apache.org Avoiding N+1 Selects(1:M and M:N)
> with iBATIS version 2.1.7
>
>
>
>
>
>
>
>
>
>
> 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
>
>
>
Re: Avoiding N+1 Selects(1:M and M:N) with iBATIS version 2.1.7
Posted by pr...@daimlerchrysler.com.
Yes, you can use it.
try
Cordiali saluti/Kind Regards.
Alessandro Allievi
(Embedded image moved to file: pic11091.gif)
www.progesoftware.it
Via Mentore Maggini, 48/50
00143 Roma
Phone +39 06.5042621
Fax +39 06.5042676
mailto: aallievi@progesoftware.it
conkmj@gmail.com
09/11/2006 03.51 To
user-java@ibatis.apache.org
cc
Please respond to
user-java@ibatis. Subject
apache.org Avoiding N+1 Selects(1:M and M:N)
with iBATIS version 2.1.7
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