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 GIMA <gi...@iol.it> on 2008/07/15 11:00:32 UTC

Batch operation on stored procedure

Hi,
In the previous ibatis release (the one that uses the following jars:
ibatis-common-2.jar, ibatis-sqlmap-2.jar, ibatis-dao-2.jar) there was a bug
concerning the batch execution on stored procedure. The batch operations
were executed in a standard mode even if the batch execution has been
declared.  
Now I’ve red that in the current release this bug has been fixed, so I’ve
made an upgrade to the new ibatis version: 2.3.2.715. 
Using this release (without changing my application code) I receive the
following error:

--- Cause: java.sql.SQLException: Missing IN or OUT parameter at index:: 32

2008-07-09 09:42:05,973 [WebContainer : 4] ERROR
com.crif.cf.engine.dao.ProcessEngineDAOImpl  -

            com.ibatis.common.jdbc.exception.NestedSQLException

             at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:107)

             at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:457)  


Debugging code I see that in the ibatis classes there is an inner class
named Batch that contains the following method:

public void addBatch(StatementScope statementScope, 
Connection conn, String sql, 
Object[] parameters) throws SQLException {
      PreparedStatement ps = null;
      if (currentSql != null && currentSql.equals(sql)) {
        int last = statementList.size() - 1;
        ps = (PreparedStatement) statementList.get(last);
      } else {
        ps = prepareStatement(statementScope.getSession(), conn, sql);
        setStatementTimeout(statementScope.getStatement(), ps);
        currentSql = sql;
        statementList.add(ps);
        batchResultList.add(new
BatchResult(statementScope.getStatement().getId(), sql));
      }
      statementScope.getParameterMap().setParameters(statementScope, ps,
parameters);
      ps.addBatch();
      size++;
    } 

The instruction ps.addBatch() generates the error I’ve posted before.

Is the bug concerning batch operation really fixed?
Should I make same changes?

Any help would be most welcome.
Thanks
Giovanni

-- 
View this message in context: http://www.nabble.com/Batch-operation-on-stored-procedure-tp18460791p18460791.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.