Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Ulises Velazquez
Added: Aug 27, 2019 7:49 PM
Views: 9
Tags: no tags
  1.     Session session;
  2.     Transaction tx;
  3.    
  4.     public void iniciaTransaccion(){
  5.         HibernateUtil con = new HibernateUtil();
  6.         session = con.getSessionFactory().openSession();
  7.         tx = session.beginTransaction();
  8.     }
  9.    
  10.     public void manejaExcepcion(HibernateException e){
  11.         tx.rollback();
  12.         throw new HibernateException("Ocurrio un error en el acceso o procesamiento de datos", e);
  13.     }