ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shannon, Bryan" <BShan...@Tribune.com>
Subject RE: Does iBatis reuse BasicResultMap object when query is dynamic ?
Date Wed, 12 Oct 2005 16:21:44 GMT
I'm not 100% sure, but shouldn't the syntax be: (using #val# instead of
$val$) ???

<select id="ad_calstatis_ctstatis_Contract_Cts"
parameterClass="java.util.Map" resultClass="java.util.HashMap">
                SELECT C0, <iterate property="p_mm_array" conjunction=",
">#p_mm_array[]#</iterate>, TOTAL, COUNT, CODE , FLOOR(OWNER_PART)
OWNER_PART, CONTRACR_GUBN
                       FROM(  ..... blah........ blah........
blah........ blah...

The difference being that the way you have it, it's just substituting in the
string.


-----Original Message-----
From: KwonNam Son [mailto:kwon37xi@gmail.com]
Sent: Tuesday, October 11, 2005 8:34 PM
To: iBatisUser
Subject: Does iBatis reuse BasicResultMap object when query is dynamic?


I think iBatis resue BasicResultMap object even though the select
query's columns are generated dinamically.

I use <iterate> for SELECT.
It's like the following.
----------------
<select id="ad_calstatis_ctstatis_Contract_Cts"
parameterClass="java.util.Map" resultClass="java.util.HashMap">
                SELECT C0, <iterate property="p_mm_array" conjunction=",
">$p_mm_array[]$</iterate>, TOTAL, COUNT, CODE , FLOOR(OWNER_PART)
OWNER_PART, CONTRACR_GUBN
                       FROM(  ..... blah........ blah........
blah........ blah...

----------------
$p_mm_array$ is dynamic.
I could be C1, C2 or C1, C2, C3, C4 ...

I ran a query which has $p_mm_array$ of C1 to C5
And after I ran a query which has $p_mm_array$ of C1 to C3.
Then I got the following error message.
--------------
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in mlb/db/ad_calstatis_ctstatis.xml.
--- The error occurred while applying a result map.
--- Check the ad_calstatis_ctstatis_Contract_Cts-AutoResultMap.
--- Check the result mapping for the 'C4_1' property.
--------------

I checked the iBatis's PreparedStatement query Log but it was ok.

So I download iBatis sources and debugged iBatis SQLMap,
then I found the BasicResultMap object of the second query(C1 to C3)
has C1 to C5!!!

THE BasicResultMap OBJECT IS REUSED even though the select query's
columns are dynamically generated!!

I use Spring 1.2.5 and iBatis 2.1.5 build 582.

Can I make iBatis NOT TO REUSE the BasicResultMap object??

Thanks.

Mime
View raw message