@SuppressWarnings("unchecked") @Override public List<Cotizacion> obtenerCotizacionCliente(Cliente cli) { Session session = HibernateUtil.getSessionFactory().openSession(); Query q = session.createQuery("from Cotizacion as c where cliente.dni=:dni "); q.setInteger("dni", cli.getDni()); return q.list(); }
@Override public void update(Cotizacion c) { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.update(c); session.flush(); session.getTransaction().commit(); session.close(); }
@Override public Cotizacion findById(Integer id) { Session session = HibernateUtil.getSessionFactory().openSession(); String hql = "from Cotizacion c where c.id = :id"; Query query = session.createQuery(hql); query.setParameter("id", id); Cotizacion c = (Cotizacion) query.uniqueResult(); session.close(); return c; }