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 "Abeyratne, Sam" <sa...@cingular.com> on 2005/06/07 02:29:10 UTC
dynamic sql within an iterate tag
Hey All,
I had asked this question before, but I didn't get an answer, so I am
re-posting this question:
I am getting the following error when I try to run a simple query that
has a dynamic <isNotEqual> within an iterate tag. Can you tell me if
this is even possible to do in iBatis?
Thanks in advance for your assistance!
Sam
2005-06-06 17:11:25,284 [HttpRequestHandler-2083] DEBUG xxxDAO.class -
Parameters: {sidList=[abc1, abc2], carrier=ABCDE1, interfaceType=DSP}
2005-06-06 17:11:25,284 [HttpRequestHandler-2083] DEBUG xxxDAO.class -
Calling queryForList with statementName: queryInterfaceErrorCount and
parameters: {sidList=[abc1, abc2], carrier= ABCDE1, interfaceType=DSP}
2005-06-06 17:11:25,294 [HttpRequestHandler-2083] ERROR
xxxDispatchAction.class - Entered catch block in viewErrorLog: Exception
in queryInterfaceErrorCount: com.ibatis.common.beans.ProbeException:
Error getting ordinal list from JavaBean. Cause
java.lang.NumberFormatException: For input string: "" Caused by:
java.lang.NumberFormatException: For input string: ""
The sqlmap looks something like:
<select id="queryInterfaceErrorCount" parameterClass="java.util.Map"
resultMap="interface_error_count_result"
cacheModel="interface_error_count_cache">
select sum(count) as count
from
(
<iterate property="sidList" open="(" close=")" conjunction="UNION
ALL">
select count(*) as count
from mim_error_log@$sidList[]$
where interface_type = #interfaceType#
<isNotEqual prepend="and" property="carrier" compareValue="All">
carrier_name = #carrier#
</isNotEqual>
</iterate>
)
</select>
Java bean looks like:
public class InterfaceErrorCount {
private int count;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
Re: dynamic sql within an iterate tag
Posted by Brandon Goodin <br...@gmail.com>.
Sam,
Sorry, I meant to respond to you in your prior email. Currently this
is not supported. But, we do want it to work. So, please file a JIRA
report. I'll work on it this evening and see if i can get the fix in
tonight.
Brandon
On 6/6/05, Abeyratne, Sam <sa...@cingular.com> wrote:
>
>
>
> Hey All,
>
>
>
> I had asked this question before, but I didn't get an answer, so I am
> re-posting this question:
>
>
>
> I am getting the following error when I try to run a simple query that has a
> dynamic <isNotEqual> within an iterate tag. Can you tell me if this is even
> possible to do in iBatis?
>
>
>
> Thanks in advance for your assistance!
>
> Sam
>
>
>
>
>
> 2005-06-06 17:11:25,284 [HttpRequestHandler-2083] DEBUG xxxDAO.class -
> Parameters: {sidList=[abc1, abc2], carrier=ABCDE1, interfaceType=DSP}
>
>
>
> 2005-06-06 17:11:25,284 [HttpRequestHandler-2083] DEBUG xxxDAO.class -
> Calling queryForList with statementName: queryInterfaceErrorCount and
> parameters: {sidList=[abc1, abc2], carrier= ABCDE1, interfaceType=DSP}
>
>
>
> 2005-06-06 17:11:25,294 [HttpRequestHandler-2083] ERROR
> xxxDispatchAction.class - Entered catch block in viewErrorLog: Exception in
> queryInterfaceErrorCount:
> com.ibatis.common.beans.ProbeException: Error getting
> ordinal list from JavaBean. Cause java.lang.NumberFormatException: For input
> string: "" Caused by: java.lang.NumberFormatException: For input string: ""
>
>
>
> The sqlmap looks something like:
>
>
>
> <select id="queryInterfaceErrorCount" parameterClass="java.util.Map"
> resultMap="interface_error_count_result"
> cacheModel="interface_error_count_cache">
>
> select sum(count) as count
>
> from
>
> (
>
> <iterate property="sidList" open="(" close=")" conjunction="UNION
> ALL">
>
> select count(*) as count
>
> from mim_error_log@$sidList[]$
>
> where interface_type = #interfaceType#
>
> <isNotEqual prepend="and" property="carrier" compareValue="All">
>
> carrier_name = #carrier#
>
> </isNotEqual>
>
> </iterate>
>
> )
>
> </select>
>
>
>
> Java bean looks like:
>
>
>
> public class InterfaceErrorCount {
>
>
>
> private int count;
>
>
>
> public int getCount() {
>
> return count;
>
> }
>
>
>
> public void setCount(int count) {
>
> this.count = count;
>
> }
>
> }