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

    HibernateSessionFactory.getSession().close();
  }
예제 #3
0
 public void preProcessing() {
   HibernateSessionFactory.getSession().beginTransaction();
 }