[ https://issues.apache.org/jira/browse/IBATIS-497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jeff Butler closed IBATIS-497. ------------------------------ Resolution: Fixed Fix Version/s: 2.3.1 Fixed in SVN. > Bug when add two same length and hashCode SQLs to a batch executor > ------------------------------------------------------------------- > > Key: IBATIS-497 > URL: https://issues.apache.org/jira/browse/IBATIS-497 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps > Reporter: Dingguo Wu > Assignee: Jeff Butler > Priority: Critical > Fix For: 2.3.1 > > Original Estimate: 1h > Remaining Estimate: 1h > > 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()) { > int last = statementList.size() - 1; > ps = (PreparedStatement) statementList.get(last); > } 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++; > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.