cleanup(null, stmt2, null);
    public List findHistorySteps(long entryId) throws StoreException {        Connection conn = null;        PreparedStatement stmt = null;        ResultSet rset = null;        try {            conn = getConnection();            String sql = "SELECT " + stepId + ", " + stepStepId + ", " + stepActionId + ", " + stepOwner + ", " + stepStartDate + ", " + stepDueDate + ", " + stepFinishDate + ", " + stepStatus + ", " + stepCaller + " FROM " + historyTable + " WHERE " + stepEntryId + " = ? ORDER BY " + stepId + " DESC";            String sql2 = "SELECT " + stepPreviousId + " FROM " + historyPrevTable + " WHERE " + stepId + " = ?";            if (log.isDebugEnabled()) {                log.debug("Executing SQL statement: " + sql);            }            stmt = conn.prepareStatement(sql);            if (log.isDebugEnabled()) {                log.debug("Executing SQL statement: " + sql2);            }            PreparedStatement stmt2 = conn.prepareStatement(sql2);            stmt.setLong(1, entryId);            rset = stmt.executeQuery();            ArrayList currentSteps = new ArrayList();            while (rset.next()) {                long id = rset.getLong(1);                int stepId = rset.getInt(2);                int actionId = rset.getInt(3);                String owner = rset.getString(4);                Date startDate = rset.getTimestamp(5);                Date dueDate = rset.getTimestamp(6);                Date finishDate = rset.getTimestamp(7);                String status = rset.getString(8);                String caller = rset.getString(9);                ArrayList prevIdsList = new ArrayList();                stmt2.setLong(1, id);                ResultSet rs = stmt2.executeQuery();                while (rs.next()) {                    long prevId = rs.getLong(1);                    prevIdsList.add(new Long(prevId));                }                long[] prevIds = new long[prevIdsList.size()];                int i = 0;                for (Iterator iterator = prevIdsList.iterator();                        iterator.hasNext();) {                    Long aLong = (Long) iterator.next();                    prevIds[i] = aLong.longValue();                    i++;                }                SimpleStep step = new SimpleStep(id, entryId, stepId, actionId, owner, startDate, dueDate, finishDate, status, prevIds, caller);                currentSteps.add(step);            }            return currentSteps;        } catch (SQLException e) {            throw new StoreException("Unable to locate history steps for workflow instance #" + entryId, e);        } finally {            cleanup(conn, stmt, rset);        }    }