List of usage examples for org.hibernate Session merge
Object merge(Object object);
From source file:com.teamj.distribuidas.model.queries.SistemaQueries.java
public static Sistema insertarSistema(Sistema sist) { Session session = HibernateUtilSeguridades.getSessionSeguridadFactory().getCurrentSession(); Sistema per = null;// w w w . j av a 2 s. c o m try { per = (Sistema) session.merge(sist); } catch (HibernateException he) { System.err.println("Error PersonaQueries al insertar."); throw he; } return per; }
From source file:com.teamj.distribuidas.model.queries.UsuarioQueries.java
public static Usuario insertarUsuario(Usuario usuario) { Session session = HibernateUtilSeguridades.getSessionSeguridadFactory().getCurrentSession(); Usuario user = null;//from w w w . j a va 2 s . c om try { user = (Usuario) session.merge(usuario); } catch (HibernateException he) { System.err.println("Error UsuarioQueries al insertar."); throw he; } return user; }
From source file:com.teamj.distribuidas.model.queries.UsuariosPerfilQueries.java
public static UsuarioXPerfil insertarUsuariosXPerfil(UsuarioXPerfil userXPerfil) { Session session = HibernateUtilSeguridades.getSessionSeguridadFactory().getCurrentSession(); UsuarioXPerfil per = null;// w ww .j av a 2 s.c o m try { per = (UsuarioXPerfil) session.merge(userXPerfil); } catch (HibernateException he) { System.err.println("Error PersonaQueries al insertar."); throw he; } return per; }
From source file:com.testing.pe.dao.ApprovalDAO.java
public AccessRequest update(AccessRequest request) { Session session = this.sessionFactory.openSession(); Transaction tx = session.beginTransaction(); session.merge(request); tx.commit();/*from www. j a va2s.c om*/ AccessRequest pm2 = session.get(AccessRequest.class, request.getId()); session.close(); return pm2; }
From source file:com.tukaloff.customers.dao.HibernateDao.java
public boolean putSession(CustomersAuth auth) { Session session = currentSession(); session.getTransaction().begin();//from w w w .ja va 2 s . com try { CustomersAuthHistory hist = new CustomersAuthHistory(); CustomersAuth authHist = session.get(CustomersAuth.class, auth.getLogin()); if (authHist != null) { hist.setLogin(authHist.getLogin()); hist.setDtm(authHist.getDtm()); hist.setApi_token(authHist.getApi_token()); session.save(hist); } session.merge(auth); } catch (Exception e) { System.out.println(e.getLocalizedMessage()); session.getTransaction().rollback(); return false; } session.getTransaction().commit(); return true; }
From source file:com.vaadinspring.presenter.UserPresenterImpl.java
public void update(List<String> updateList) { Users newUser = getUser(updateList.get(0)); newUser.setPassword(updateList.get(1)); newUser.setEmail(updateList.get(2)); newUser.setRole(findRole(updateList.get(3))); Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();//w w w . j a va2 s.co m Users user = (Users) session.merge(newUser); session.saveOrUpdate(user); session.getTransaction().commit(); session.close(); }
From source file:com.vaadinspring.presenter.UserPresenterImpl.java
public void edit(List<String> editList) { Users newUser = getUser(editList.get(0)); newUser.setPassword(editList.get(1)); newUser.setEmail(editList.get(2));/*from www .j a va2 s .co m*/ newUser.setImage(editList.get(4)); Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); Users user = (Users) session.merge(newUser); session.saveOrUpdate(user); session.getTransaction().commit(); session.close(); }
From source file:com.vaadinspring.service.UsersService.java
public void update(Users newUser) { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction();/*from w w w . j av a 2 s . c om*/ Users user = (Users) session.merge(newUser); session.saveOrUpdate(user); session.getTransaction().commit(); session.close(); }
From source file:com.zhu.service.CarService.java
public void updCar(Car car) { Session session = HibernateSessionFactory.getSession(); session.clear();//from w ww.j ava 2 s. c o m Transaction transaction = session.beginTransaction(); session.merge(car); session.flush(); transaction.commit(); session.close(); }
From source file:controlador.HibernateUsuariosDAO.java
public void update(Usuarios usuario) { SessionFactory sessionFactory = HibernateSession.getSessionFactory(); Session session = sessionFactory.openSession(); session.beginTransaction();//from w w w. ja v a2 s .co m session.merge(usuario); session.getTransaction().commit(); session.close(); }