Description
When I use batch execute, I found some SQL didn't execute sometime. I debuged and found a bug at com.ibatis.sqlmap.engine.execution.SqlExecutor$Batch.addBatch.
When two SQL strings have same length and same hashCode ,this bug happens. Unfortunately, It happened to me . Does anybody believe that "B6" and "AU" have same hashCode? That is problem.
the code :
public void addBatch(RequestScope request, Connection conn, String sql, Object[] parameters) throws SQLException {
PreparedStatement ps = null;
if (currentSql != null && sql.hashCode() == currentSql.hashCode() && sql.length() == currentSql.length())
else
{ ps = conn.prepareStatement(sql); setStatementTimeout(request.getStatement(), ps); currentSql = sql; statementList.add(ps); batchResultList.add(new BatchResult(request.getStatement().getId(), sql)); } request.getParameterMap().setParameters(request, ps, parameters);
ps.addBatch();
size++;
}