{merchantId = TERM_ID,#merchants#,#startDate#,#endDate#}
That's formatted incorrectly... it should be:
{param1=col1, param2=col2, param3=col3}
And the second problem is that the #merchants# column will not be loaded as
a collection so you can't use the merchants[] iterator like that.
Clinton
On Tue, Aug 19, 2008 at 7:35 AM, kiran vuppla
<[EMAIL PROTECTED]>wrote:
> Can some one please let me know what would be the issue?
>
> Thanks,
> Kiran
>
> --- On *Mon, 8/18/08, kiran vuppla <[EMAIL PROTECTED]>* wrote:
>
> From: kiran vuppla <[EMAIL PROTECTED]>
> Subject: Invalid Column Name error
> To: "iBatis Forum" <[email protected]>
> Date: Monday, August 18, 2008, 7:43 PM
>
>
> I am getting the following error, I will appreciate if some can let me
> know what is the issue. Thanks in Advance.
>
> --- The error occurred while applying a result map.
> --- Check the merchant.getMaxValue.
> --- Check the result mapping for the 'max' property.
> --- Cause: java.sql.SQLException: Invalid column name
> at
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
> at
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:298)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:209)
> ... 72 more
>
>
> <resultMap id="DistributionResult" class="Distribution">
> <result property="totalProducts" column="TOTAL_PRODUCTS"/>
> <result property="totalAmt" column="TOTAL_AMT"/>
> <result property="merchant.id" column="TERM_ID"/>
> <result property="max" column="{merchantId =
> TERM_ID,#merchants#,#startDate#,#endDate#}" select="merchant.getMaxValue"/>
> </resultMap>
>
> <select id="getDistribution" parameterClass="map"
> resultMap="DistributionResult">
> SELECT COUNT(*) as TOTAL_PRODUCTS
> , SUM(a.amount) as TOTAL_AMT
> , A.TERMID as TERM_ID
> FROM tbl a, tbl b
> WHERE a.termid = b.id
> <iterate property="merchants" open=" and a.SATHCDHACCTKEY in ("
> close = ")" conjunction=",">
> #merchants[]#
> </iterate>
> AND a.dtathdate BETWEEN #startDate# AND #endDate# group by A.TERMID
> </select>
>
> <select id="getMaxVALue" resultClass="int">
> SELECT MAX(subTbl.cnt1) as value from (SELECT COUNT(A.KEY ) as cnt1
> FROM ath a, merchantterminal m WHERE A.SATHTERMID = M.LID and M.LID =
> #merchantId#
> <iterate property="merchants" open=" and a.KEY in (" close = ")"
> conjunction=",">
> #merchants[]#
> </iterate>
> AND a.dtathdate BETWEEN #startDate# AND #endDate# group by
> to_char(a.dtathdate,'YYYYMMDD') ) subTbl
> </select>
>
> Thanks
> Kiran
>
>
>