ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Celaya, Tina \(GE Indust, ConsInd\)" <tina.cel...@ge.com>
Subject Problem Using Iterate
Date Wed, 11 Oct 2006 21:11:53 GMT
Hello, i want to use the iterator tag and dinamicaly create the select and the groupby list
for the colums i want to get I have this query now

<select id="getSVMarketCC" parameterClass="java.util.Map" resultClass="salesVariance">
      <![CDATA[
      select
      typeName,
      productGroup,
      pline,
      customer,
      sum(totalUnits) units,
      sum(totalAmount) sales,
      sum(totalProvision) rebates
      from (
      select
      p.pl pline, c.cliente customer, p.pg productGroup
      case when c.nacional=2 then case when c.geco = 1 then 'EXPO INT'
      else case when c.geco = 2 then 'EXPO ROW' end end else 'DOMESTIC' end typeName,
      sum( isnull(cc.cantidad,0)*isnull(p.pack,1)-case when cc.transaccion='CM'
      and cc.o_tipo_tran in ('GECM-OTHER-MXP-CM','GECM-OTHER-USD-CM') and cc.cantidad>0
      and cc.subtotal<0 and cc.preciounitario<0 then cc.cantidad else 0 end) totalUnits,
      sum((cc.subtotal-(isnull(cc.provision,0)))* case when moneda='USD' then #tc# else 1
end) totalAmount,
      sum(isnull(cc.provision,0)* case when moneda='USD' then #tc# else 1 end) totalProvision
      from incentivos..carteraclientes cc
      left outer join om..productos p on cc.producto=p.oid
      left outer join om..clientes c on cc.cliente=c.oid
      where cc.transaccion in ('INV','ADJ','CM','DM')
      and cc.mes < #mesFin#
      and cc.mes > #mesIni#
      and cc.ano = #anio#
      group by
      c.nacional,c.geco,p.pl, c.cliente, p.pg) a
      group by typeName, productGroup, pline,customer
      ]]>
    </select>

And i sent this hashmap as the parameterClass
hm.put("mesFin",new Integer(month1))
hm.put("mesIni",new Integer(month2))
hm.put("tc",new Double (exchType))
hm.put("anio",new Integer(year))

What i want now is to add a List containing the strings "productGroup","pline","customer"
hm.put("list1",list) and do this:

<select id="getSVMarketCC" parameterClass="java.util.Map" resultClass="salesVariance">
      <![CDATA[
      select
      typeName,
      sum(totalUnits) units,
      sum(totalAmount) sales,
      sum(totalProvision) rebates

      <iterate prepend="," open="" close="" conjunction=",">
        #list1[]#
      </iterate>

      from (
      select
      p.pl pline, c.cliente customer, p.pg productGroup
      case when c.nacional=2 then case when c.geco = 1 then 'EXPO INT'
      else case when c.geco = 2 then 'EXPO ROW' end end else 'DOMESTIC' end typeName,
      sum( isnull(cc.cantidad,0)*isnull(p.pack,1)-case when cc.transaccion='CM'
      and cc.o_tipo_tran in ('GECM-OTHER-MXP-CM','GECM-OTHER-USD-CM') and cc.cantidad>0
      and cc.subtotal<0 and cc.preciounitario<0 then cc.cantidad else 0 end) totalUnits,
      sum((cc.subtotal-(isnull(cc.provision,0)))* case when moneda='USD' then #tc# else 1
end) totalAmount,
      sum(isnull(cc.provision,0)* case when moneda='USD' then #tc# else 1 end) totalProvision
      from incentivos..carteraclientes cc
      left outer join om..productos p on cc.producto=p.oid
      left outer join om..clientes c on cc.cliente=c.oid
      where cc.transaccion in ('INV','ADJ','CM','DM')
      and cc.mes < #mesFin#
      and cc.mes > #mesIni#
      and cc.ano = #anio#
      group by
      c.nacional,c.geco,p.pl, c.cliente, p.pg) a
      group by typeName  
      
      <iterate prepend="," open="" close="" conjunction=",">
        #list1[]#
      </iterate>  
      ]]>
 </select>

But i´m getting this error
--- Check the getSVMarketCC.  
--- Check the parameter map.  
--- Cause: 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: ""
Caused by: 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: ""

can anyone help me?



Tina Celaya
GE Consumer & Industrial
Systems Analyst

T +52 81 8318 5306
F +52 81 8318 5692
D *241 5306
E tina.celaya@ge.com
www.geindustrial.com.mx

Av. Churubusco 3900 Nte.
Col Industrial B. Juarez
Monterrey NL CP 64517
GE Equipo de Control y Distribucion S. de RL de CV



Mime
View raw message