List of usage examples for org.hibernate Session save
Serializable save(Object object);
From source file:app.datos.servicios.implementacion.HistorialServiceImpl.java
License:Open Source License
@Override @Transactional(rollbackFor = PersistenciaException.class) public void guardarHistorialInmueble(HistorialInmueble historialInmueble) throws PersistenciaException { Session session = getSessionFactory().getCurrentSession(); try {/*from w w w . j a v a2 s . c o m*/ session.save(historialInmueble); } catch (Exception e) { throw new SaveUpdateException(e); } }
From source file:app.datos.servicios.implementacion.InmuebleServiceImpl.java
License:Open Source License
@Override @Transactional(rollbackFor = PersistenciaException.class) public void guardarInmueble(Inmueble inmueble) throws PersistenciaException { Session session = getSessionFactory().getCurrentSession(); try {// w w w .ja va 2 s. c om session.save(inmueble); } catch (Exception e) { throw new SaveUpdateException(e); } }
From source file:app.datos.servicios.implementacion.PropietarioServiceImpl.java
License:Open Source License
@Override @Transactional(rollbackFor = PersistenciaException.class) //si falla hace rollback de la transaccin public void guardarPropietario(Propietario propietario) throws PersistenciaException { Session session = getSessionFactory().getCurrentSession(); try {//w w w . jav a 2 s .c om session.save(propietario); } catch (Exception e) { throw new SaveUpdateException(e); } }
From source file:app.datos.servicios.implementacion.ReservaServiceImpl.java
License:Open Source License
@Override @Transactional(rollbackFor = PersistenciaException.class) //si falla hace rollback de la transaccin public void guardarReserva(Reserva reserva) throws PersistenciaException { Session session = getSessionFactory().getCurrentSession(); try {/*from www. j a va 2 s . com*/ session.save(reserva); } catch (Exception e) { throw new SaveUpdateException(e); } }
From source file:app.datos.servicios.implementacion.VendedorServiceImpl.java
License:Open Source License
@Override @Transactional(rollbackFor = PersistenciaException.class) //si falla hace rollback de la transaccin public void guardarVendedor(Vendedor vendedor) throws PersistenciaException { Session session = getSessionFactory().getCurrentSession(); try {/*from w ww .ja va 2 s . c om*/ session.save(vendedor); } catch (Exception e) { throw new SaveUpdateException(e); } }
From source file:app.datos.servicios.implementacion.VentaServiceImpl.java
License:Open Source License
@Override @Transactional(rollbackFor = PersistenciaException.class) //si falla hace rollback de la transaccin public void guardarVenta(Venta venta) throws PersistenciaException { Session session = getSessionFactory().getCurrentSession(); try {// w w w .java 2 s . c om session.save(venta); } catch (Exception e) { throw new SaveUpdateException(e); } }
From source file:app.Ejer1.java
public static void insertSeguro(Seguro seguro) { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); Session session = sessionFactory.openSession(); session.beginTransaction();/*w w w. ja va 2 s. c o m*/ session.save(seguro); session.getTransaction().commit(); session.close(); }
From source file:app.Ejer2.java
public static void insertSeguro(SeguroAnotaciones seguro) { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); Session session = sessionFactory.openSession(); session.beginTransaction();//w w w. j a va 2 s . c o m session.save(seguro); session.getTransaction().commit(); session.close(); }
From source file:app.model.repository.impl.UserDaoImpl.java
@Transactional @Override/*from w w w. ja v a 2 s . c om*/ public void addUser(User user) { Session session = sessionFactory.getCurrentSession(); Transaction transaction = session.getTransaction(); //session.persist(user); //Logger.getLogger(this.getClass().getName()).info("ok??"); //session.persist(user); //session.save(user); try { transaction.begin(); // session.persist(user); session.save(user); transaction.commit(); // Logger.getLogger(this.getClass().getName()).info("OKOK"); } catch (Exception e) { e.printStackTrace(); transaction.rollback(); } finally { if (session.isOpen()) session.close(); } }
From source file:app.packages.domain.repository.impl.UserDaoImpl.java
@Transactional @Override//from w w w. ja va2s. c o m public void addUser(User user) { Session session = sessionFactory.getCurrentSession(); Transaction transaction = session.getTransaction(); //session.persist(user); Logger.getLogger(this.getClass().getName()).info("ok??"); //session.persist(user); //session.save(user); try { transaction.begin(); // session.persist(user); session.save(user); transaction.commit(); Logger.getLogger(this.getClass().getName()).info("OKOK"); } catch (Exception e) { e.printStackTrace(); transaction.rollback(); } finally { if (session.isOpen()) session.close(); } }