List of usage examples for org.hibernate Session delete
void delete(Object object);
From source file:br.ufg.calendario.dao.InteressadoDao.java
@Transactional public boolean excluir(Interessado interessado) { Session session = this.sessionFactory.getCurrentSession(); try {//from ww w . j a va2 s . co m session.delete(interessado); return true; } catch (HibernateException e) { System.out.println(e.getMessage()); session.clear(); return false; } }
From source file:br.ufg.calendario.dao.RegionalDao.java
@Transactional public boolean excluir(Regional regional) { Session session = sessionFactory.getCurrentSession(); try {/*from ww w . j a v a 2 s.c o m*/ session.delete(regional); return true; } catch (HibernateException e) { System.out.println(e.getMessage()); return false; } }
From source file:br.ufg.calendario.dao.UsuarioDao.java
@Transactional public boolean excluir(Usuario usuario) { Session session = sessionFactory.getCurrentSession(); try {/*from ww w . j a v a 2s .co m*/ session.delete(usuario); return true; } catch (HibernateException e) { System.out.println(e.getMessage()); session.clear(); return false; } }
From source file:br.ufg.inf.es.fs.contpatri.persistencia.dao.GenericDAOImpl.java
License:GNU General Public License
@Override public void delete(T entity) { try {/*w w w .j a va 2 s. c om*/ HibernateUtil.beginTransaction(); Session hibernateSession = this.getSession(); hibernateSession.delete(entity); HibernateUtil.commitTransaction(); } catch (HibernateException e) { HibernateUtil.rollbackTransaction(); throw e; } }
From source file:br.ufg.inf.es.fs.contpatri.web.persistencia.dao.GenericDAOImpl.java
License:GNU General Public License
@Override public void delete(T entity) { Session hibernateSession = this.getSession(); hibernateSession.delete(entity); }
From source file:br.ufmt.ic.paw2.DAO.PacienteDAO.java
public void excluir(final Paciente paciente) { Paciente merge;/*from ww w .jav a 2s . c o m*/ Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); if ((paciente != null) && (paciente.getId() > 0)) { merge = (Paciente) session.merge(paciente); session.delete(merge); } t.commit(); }
From source file:br.unisal.dao.ConsultaDao.java
public void remove(Consulta c) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); try {/* w ww . j a v a2 s . com*/ tx.begin(); session.delete(c); tx.commit(); } catch (HibernateException e) { System.out.println("Exception ConsultaDao.remove(): " + e.getMessage()); tx.rollback(); } finally { session.close(); } }
From source file:br.unisal.dao.EquipamentoDao.java
@Override public void remove(Equipamento s) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); try {// ww w . j a va2 s. co m tx.begin(); session.delete(s); tx.commit(); } catch (HibernateException e) { System.out.println("Exception EquipamentoDao.remove(): " + e.getMessage()); tx.rollback(); } finally { session.close(); } }
From source file:br.unisal.dao.GenericDao.java
public void remove(Object entity) { Session session = HibernateUtil.getInstance().getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); try {// www .j a va2 s.c o m tx.begin(); session.delete(entity); tx.commit(); } catch (HibernateException e) { tx.rollback(); throw new RuntimeException(e); } finally { session.close(); } }
From source file:br.unisal.dao.MedicoDao.java
public void remove(Medico m) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); try {/*from w w w.ja va2s . c om*/ tx.begin(); session.delete(m); tx.commit(); } catch (HibernateException e) { System.out.println("Exception MedicoDao.remove(): " + e.getMessage()); tx.rollback(); } finally { session.close(); } }