if (entry.getHistorySteps() == null) { ArrayList hSteps = new ArrayList(1); hSteps.add(hStep); entry.setHistorySteps(hSteps); } else { entry.getHistorySteps().add(hStep); }
try { session.save(entry); tx.commit();
    public void moveToHistory(Step step) {        HibernateWorkflowEntry entry;        try {            entry = (HibernateWorkflowEntry) session.find("FROM entry IN CLASS " + HibernateWorkflowEntry.class.getName() + " WHERE entry.id = ?", new Long(step.getEntryId()), Hibernate.LONG).get(0);        } catch (HibernateException e) {            log.error("An exception occured", e);            return;        }        HibernateHistoryStep hStep = new HibernateHistoryStep((HibernateStep) step);        entry.getCurrentSteps().remove(step);        if (entry.getHistorySteps() == null) {            ArrayList hSteps = new ArrayList(1);            hSteps.add(hStep);            entry.setHistorySteps(hSteps);        } else {            entry.getHistorySteps().add(hStep);        }        try {            session.save(entry);            //session.delete(step);            //session.save(hStep, new Long(hStep.getId()));        } catch (HibernateException e) {            log.error("An exception occured", e);        }    }