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


      

Reply via email to