public void execute() { try { preProcessing(); processing(); postProcessing(); } catch (Exception e) { errors.add(e.getMessage()); e.printStackTrace(); if (HibernateSessionFactory.getSession().getTransaction().isActive()) HibernateSessionFactory.getSession().getTransaction().rollback(); HibernateSessionFactory.getSession().close(); } }
public void postProcessing() { if (HibernateSessionFactory.getSession().getTransaction().isActive()) HibernateSessionFactory.getSession().getTransaction().commit(); HibernateSessionFactory.getSession().close(); }
public void preProcessing() { HibernateSessionFactory.getSession().beginTransaction(); }