Esempio n. 1
0
  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();
    }
  }
Esempio n. 2
0
  public void postProcessing() {
    if (HibernateSessionFactory.getSession().getTransaction().isActive())
      HibernateSessionFactory.getSession().getTransaction().commit();

    HibernateSessionFactory.getSession().close();
  }
Esempio n. 3
0
 public void preProcessing() {
   HibernateSessionFactory.getSession().beginTransaction();
 }