0

Now, I want to update my data for batch, but When I run the console when given as follows:

--- The error occurred in ibatis-config/emptyForIbatisParse_sqlmap.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the VehQuaCer.updateAmtBal.
--- Cause: java.sql.SQLException: Invalid parameter object type. Expected 'java.util.List' but found 'app.creditapp.lam.entity.VehQuaCer'.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ibatis-config/emptyForIbatisParse_sqlmap.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the VehQuaCer.updateAmtBal.
--- Cause: java.sql.SQLException: Invalid parameter object type. Expected 'java.util.List' but found 'app.creditapp.lam.entity.VehQuaCer'.

My DaoImpl method is as follows:

public void updateRelease(final List<VehQuaCer> list) throws DAOException {
        try{
        if(list!=null){
            this.getSqlMapClientTemplate().execute(new SqlMapClientCallback(){
                public Object doInSqlMapClient(SqlMapExecutor executor)throws SQLException{
                    executor.startBatch();
                    for(int i=0,j=list.size();i<j;i++){
                        executor.update("VehQuaCer.updateAmtBal",(VehQuaCer)list.get(i));
                    }
                    executor.executeBatch();
                    return null;
                }
            });
        }
    }catch(Exception e){
        log.error(e);
        throw new DAOException(e.getMessage());
    }

    }

My ibatis is as follows:

<update id="VehQuaCer.updateAmtBal" parameterClass="java.util.List">
    begin
    <iterate conjunction="">
    UPDATE VEH_QUA_CER SET REPAY_BAL=#[].repayBal#,SEC_BAL=#[].secBal#,ADV_BAL=#[].advBal#,RELEASE_APP_NO=#[].releaseApp# WHERE ID=#[].id#
    </iterate>
    end;
    </update>
2
  • My DaoImp method is as follows :' public void updateRelease(final List<VehQuaCer> list) throws DAOException { try{ if(list!=null){ this.getSqlMapClientTemplate().execute(new SqlMapClientCallback(){ public Object doInSqlMapClient(SqlMapExecutor executor)throws SQLException{ executor.startBatch(); for(int i=0,j=list.size();i<j;i++){ executor.update("VehQuaCer.updateAmtBal",(VehQuaCer)list.get(i)); } executor.executeBatch(); return null; } }); } }catch(Exception e){ log.error(e); throw new DAOException(e.getMessage()); } }'
    – Naughty99
    Aug 5, 2015 at 2:34
  • Edit your post and put your code there. It's impossible to read it if you put it in a comment.
    – Micho
    Aug 5, 2015 at 2:38

1 Answer 1

0

From the code you have provided it seems that your query is expecting parameter as List but since in your DAOImpl if you have already iterated through the list and passing only 'VehQuaCer' object, so changing the paramterclass to VehQuaCer with full yqualified name should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.