List of usage examples for org.hibernate Session delete
void delete(Object object);
From source file:br.com.sigcopex.dao.DisciplinaDAO.java
public void excluir(Disciplina disciplina) { Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction transacao = null;/*from w w w . j a v a 2s . c o m*/ try { transacao = sessao.beginTransaction(); sessao.delete(disciplina); transacao.commit(); } catch (RuntimeException ex) { if (transacao != null) { transacao.rollback(); } throw ex; } finally { sessao.close(); } }
From source file:br.com.sigcopex.dao.ExtensaoDAO.java
public void excluir(Extensao extensao) { Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction transacao = null;/*from w ww . ja v a2s . c om*/ try { transacao = sessao.beginTransaction(); sessao.delete(extensao); transacao.commit(); } catch (RuntimeException ex) { if (transacao != null) { transacao.rollback(); } throw ex; } finally { sessao.close(); } }
From source file:br.com.sigcopex.dao.MonitoriaDAO.java
public void excluir(Monitoria monitoria) { Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction transacao = null;//from ww w . ja va2 s. com try { transacao = sessao.beginTransaction(); sessao.delete(monitoria); transacao.commit(); } catch (RuntimeException ex) { if (transacao != null) { transacao.rollback(); } throw ex; } finally { sessao.close(); } }
From source file:br.com.sigcopex.dao.ProfessorDAO.java
public void excluir(Professor professor) { Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction transacao = null;//from w w w .j a v a2s .c om try { transacao = sessao.beginTransaction(); sessao.delete(professor); transacao.commit(); } catch (RuntimeException ex) { if (transacao != null) { transacao.rollback(); } throw ex; } finally { sessao.close(); } }
From source file:br.com.sigcopex.dao.TermoAutorizacaoExtensaoDAO.java
public void excluir(TermoAutorizacaoExtensao termoAutorizacaoExtensao) { Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction transacao = null;/*w ww .j ava 2 s . c o m*/ try { transacao = sessao.beginTransaction(); sessao.delete(termoAutorizacaoExtensao); transacao.commit(); } catch (RuntimeException ex) { if (transacao != null) { transacao.rollback(); } throw ex; } finally { sessao.close(); } }
From source file:br.com.sinax.musicpoc.dao.MusicDaoImpl.java
License:Apache License
@Override public void remove(Music entity) { Session session = sessionProvider.provide(); session.beginTransaction();/*from w w w . j a v a 2 s .co m*/ session.delete(entity); session.getTransaction().commit(); if (session.isOpen()) { session.close(); } }
From source file:br.com.sistemapesca.test.TestesBrutos.java
public static void main(String[] args) { Apontador a = new Apontador(); Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction trans = sessao.beginTransaction(); try {//from w ww .j av a 2 s . co m List<Apontador> as = new ArrayList<>(); as = sessao.createCriteria(Apontador.class).list(); System.out.println("Quantidade no banco" + as.size()); a = as.get(0); sessao.delete(a); System.out.println("Quantidade no banco" + as.size()); // while (!as.isEmpty()) { // as.remove(0); // } System.out.println("AQUIEEEEEEEE " + as.size()); // Pessoa p = new Pessoa(); // p.setNome("JOHN TESTE"); // p.setTelefone("9090909090"); // p.setDataCadastro(new Date()); // Tecnico t = new Tecnico(); // t.getPessoa().setNome("Camille Frazo"); // t.getPessoa().setDataCadastro(new Date()); // // Apontador a = new Apontador(); // a.getPessoa().setNome("John Gomes"); // a.getPessoa().setDataCadastro(new Date()); // a.getPessoa().setTelefone("9879887"); trans.commit(); } catch (Exception e) { System.out.println("DEU MERDA"); } finally { sessao.close(); } }
From source file:br.com.tpartner.persistence.crud.implementation.GenericCRUDImplementation.java
@Override public void delete(T entity) { Session session = getCurrentSession(); Transaction tx = session.beginTransaction(); session.delete(entity); tx.commit();// w w w . j av a 2 s . co m session.close(); }
From source file:br.com.ufmt.fata.dao.ComplementoDaoImp.java
@Override public void remove(Complemento complemento) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); session.delete(complemento); t.commit();//from w ww .j a v a2s.c o m session.close(); }
From source file:br.com.ufmt.fata.dao.PastaDeComunicacaoDaoImp.java
@Override public void remove(PastaDeComunicacao pastaDeComunicacao) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); session.delete(pastaDeComunicacao); t.commit();/*from www. j a va2s. co m*/ session.close(); }