String sql = "INSERT INTO " + historyTable + " (" + stepId + "," + stepEntryId + ", " + stepStepId + ", " + stepActionId + ", " + stepOwner + ", " + stepStartDate + ", " + stepFinishDate + ", " + stepStatus + ", " + stepCaller + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
String sql = "INSERT INTO " + historyTable + " (" + stepId + ',' + stepEntryId + ", " + stepStepId + ", " + stepActionId + ", " + stepOwner + ", " + stepStartDate + ", " + stepFinishDate + ", " + stepStatus + ", " + stepCaller + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
    public void moveToHistory(Step step) throws StoreException {        Connection conn = null;        PreparedStatement stmt = null;        try {            conn = getConnection();            String sql = "INSERT INTO " + historyTable + " (" + stepId + "," + stepEntryId + ", " + stepStepId + ", " + stepActionId + ", " + stepOwner + ", " + stepStartDate + ", " + stepFinishDate + ", " + stepStatus + ", " + stepCaller + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";            if (log.isDebugEnabled()) {                log.debug("Executing SQL statement: " + sql);            }            stmt = conn.prepareStatement(sql);            stmt.setLong(1, step.getId());            stmt.setLong(2, step.getEntryId());            stmt.setInt(3, step.getStepId());            stmt.setInt(4, step.getActionId());            stmt.setString(5, step.getOwner());            stmt.setTimestamp(6, new Timestamp(step.getStartDate().getTime()));            if (step.getFinishDate() != null) {                stmt.setTimestamp(7, new Timestamp(step.getFinishDate().getTime()));            } else {                stmt.setNull(7, Types.TIMESTAMP);            }            stmt.setString(8, step.getStatus());            stmt.setString(9, step.getCaller());            stmt.executeUpdate();            long[] previousIds = step.getPreviousStepIds();            if ((previousIds != null) && (previousIds.length > 0)) {                sql = "INSERT INTO " + historyPrevTable + " (" + stepId + ", " + stepPreviousId + ") VALUES (?, ?)";                log.debug("Executing SQL statement: " + sql);                cleanup(null, stmt, null);                stmt = conn.prepareStatement(sql);                for (int i = 0; i < previousIds.length; i++) {                    long previousId = previousIds[i];                    stmt.setLong(1, step.getId());                    stmt.setLong(2, previousId);                    stmt.executeUpdate();                }            }            sql = "DELETE FROM " + currentPrevTable + " WHERE " + stepId + " = ?";            if (log.isDebugEnabled()) {                log.debug("Executing SQL statement: " + sql);            }            cleanup(null, stmt, null);            stmt = conn.prepareStatement(sql);            stmt.setLong(1, step.getId());            stmt.executeUpdate();            sql = "DELETE FROM " + currentTable + " WHERE " + stepId + " = ?";            if (log.isDebugEnabled()) {                log.debug("Executing SQL statement: " + sql);            }            cleanup(null, stmt, null);            stmt = conn.prepareStatement(sql);            stmt.setLong(1, step.getId());            stmt.executeUpdate();        } catch (SQLException e) {            throw new StoreException("Unable to move current step to history step for #" + step.getEntryId(), e);        } finally {            cleanup(conn, stmt, null);        }    }