List stepIdList = new ArrayList(previousIds.length);
for (int i = 0; i < previousIds.length; i++) { long previousId = previousIds[i]; stepIdList.add(new Long(previousId)); }
    public Step createCurrentStep(long entryId, int stepId, String owner, Date startDate, Date dueDate, String status, long[] previousIds) {        HibernateCurrentStep step = new HibernateCurrentStep();        HibernateWorkflowEntry entry;        try {            entry = (HibernateWorkflowEntry) session.find("FROM entry in CLASS " + HibernateWorkflowEntry.class.getName() + " WHERE entry.id = ?", new Long(entryId), Hibernate.LONG).get(0);        } catch (HibernateException e) {            log.error("An exception occured", e);            return null;        }        step.setEntry(entry);        step.setStepId(stepId);        step.setOwner(owner);        step.setStartDate(startDate);        step.setDueDate(dueDate);        step.setStatus(status);        List stepIdList = new ArrayList(previousIds.length);        for (int i = 0; i < previousIds.length; i++) {            long previousId = previousIds[i];            stepIdList.add(new Long(previousId));        }        if (!stepIdList.isEmpty()) {            String stepIds = TextUtils.join(", ", stepIdList);            try {                step.setPreviousSteps(session.find("FROM step in CLASS " + HibernateCurrentStep.class.getName() + " WHERE step.id IN (" + stepIds + ")"));            } catch (HibernateException e) {                log.error("An exception occured", e);            }        } else {            step.setPreviousSteps(Collections.EMPTY_LIST);        }        if (entry.getCurrentSteps() == null) {            ArrayList cSteps = new ArrayList(1);            cSteps.add(step);            entry.setCurrentSteps(cSteps);        } else {            entry.getCurrentSteps().add(step);        }        try {            session.save(entry);            //session.save(step);            return step;        } catch (HibernateException e) {            log.error("An exception occured", e);            return null;        }    }