@Override public void update(Complemento complemento) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); session.update(complemento); t.commit(); session.close(); }
@Override public List<Complemento> list() { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); List lista = session.createQuery("from Complemento").list(); t.commit(); session.close(); return lista; }