List of usage examples for org.hibernate Session merge
Object merge(Object object);
From source file:dao.DAOPadrao.java
public boolean merge(IModelo m) { boolean retorno = false; Session sessao = null; Transaction t = null;/*from w w w .j av a 2 s . co m*/ try { sessao = HibernateUtil.getSessionFactory().openSession(); t = sessao.beginTransaction(); sessao.merge(m); t.commit(); retorno = true; } catch (HibernateException he) { he.printStackTrace(); t.rollback(); } finally { sessao.close(); } return retorno; }
From source file:dao.DetalleDaoImpl.java
@Override public boolean create(Detalleventa venta) { boolean flag; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try {/*from w w w. j a v a 2 s . c o m*/ session.beginTransaction(); session.merge(venta); session.getTransaction().commit(); flag = true; } catch (Exception e) { flag = false; throw e; } return flag; }
From source file:DAO.EmpleadoImplements.java
@Override public void insertarEmpleado(Empleados empleado) { Session session = null; try {/*from w ww .j a v a 2s. c o m*/ session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.merge(empleado); session.getTransaction().commit(); } catch (HibernateException e) { System.out.println(e.getMessage()); session.getTransaction().rollback(); } finally { if (session != null) { session.close(); } } }
From source file:DAO.FacturaImplements.java
@Override public void insertarFactura(Facturas factura) { Session session = null; try {//from ww w.j av a 2s. c o m session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.merge(factura); session.getTransaction().commit(); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "La factura fue creada con exito", "No se puedo crear la factura")); } catch (HibernateException e) { System.out.println(e.getMessage()); session.getTransaction().rollback(); } finally { if (session != null) { session.close(); } } }
From source file:Dao.FavoriteMovieDAO.java
public void addFavoriteMovie(FavoriteMovie u) { Session session = this.sessionFactory.getCurrentSession(); session.merge(u); logger.info("FavoriteMovie saved successfully, FavoriteMovie Details=" + u); }
From source file:Dao.FavoriteTheatreDAO.java
public void addFavoriteTheatre(FavoriteTheatre u) { Session session = this.sessionFactory.getCurrentSession(); session.merge(u); logger.info("FavoriteTheatre saved successfully, FavoriteTheatre Details=" + u); }
From source file:Dao.MovieDAO.java
public void addMovie(Movie m) { Session session = this.sessionFactory.getCurrentSession(); session.merge(m); logger.info("Movie saved successfully, Movie Details=" + m); }
From source file:Dao.ShowingDAO.java
public void addShowing(Showing u) { Session session = this.sessionFactory.getCurrentSession(); session.merge(u); logger.info("Showing saved successfully, Showing Details=" + u); }
From source file:DAO.SucursalesPorRutaImplements.java
@Override public void insertarSucXRuta(Sucursalesxruta sxr) { Session session = null; try {/* ww w.j ava 2s . co m*/ session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.merge(sxr); session.getTransaction().commit(); } catch (HibernateException e) { System.out.println(e.getMessage()); session.getTransaction().rollback(); } finally { if (session != null) { session.close(); } } }
From source file:dao.TituloDao.java
public void atualiza(Titulo titulo) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = null;// w w w .j av a 2 s . c o m try { t = session.beginTransaction(); session.merge(titulo); t.commit(); } catch (Exception e) { if (t != null) t.rollback(); throw e; } finally { session.close(); } }