List of usage examples for org.hibernate Session delete
void delete(Object object);
From source file:br.com.Dao.HibernateDao.java
@Override public void remove(T entity) { Session.delete(entity); }
From source file:br.com.dao.UsuarioImp.java
public void remove(Usuario usuario) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); session.delete(usuario); t.commit();//from ww w . j a va 2 s . com }
From source file:br.com.gaiatosfc.DAO.AdversariosDAOImp.java
@Override public void deletar(Adversarios jogador) throws DAOException { Session session = null; try {//w w w .j a v a 2 s. c o m session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); session.delete(jogador); t.commit(); } catch (Exception e) { session.getTransaction().rollback(); throw new DAOException(e); } finally { if (session != null) { session.close(); } } }
From source file:br.com.gaiatosfc.DAO.CampeonatosDAOImp.java
@Override public void deletar(Campeonatos campeonato) throws DAOException { Session session = null; try {/* ww w. j a v a 2s.c om*/ session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); session.delete(campeonato); t.commit(); } catch (Exception e) { session.getTransaction().rollback(); throw new DAOException(e); } finally { if (session != null) { session.close(); } } }
From source file:br.com.gaiatosfc.DAO.JogadoresDAOImp.java
@Override public void deletar(Jogadores jogador) throws DAOException { Session session = null; try {/*from ww w . j a v a 2s. c o m*/ session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); session.flush(); session.delete(jogador); t.commit(); session.clear(); } catch (Exception e) { session.getTransaction().rollback(); throw new DAOException(e); } finally { if (session != null) { session.close(); } } }
From source file:br.com.jn.dao.CandidatoDAO.java
public Boolean excluir(Candidato candidato) { try {/*from ww w . j av a 2s .c o m*/ Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.delete(candidato); session.getTransaction().commit(); session.close(); return true; } catch (HibernateException e) { System.out.println(e.toString()); return false; } }
From source file:br.com.jn.dao.UsersDAO.java
public Boolean excluir(Users users) { try {/*from w ww . jav a2 s. com*/ Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.delete(users); session.getTransaction().commit(); session.close(); return true; } catch (HibernateException e) { System.out.println(e.toString()); return false; } }
From source file:br.com.livraria.dao.AutorDAO.java
public void excluir(Autor autor) { Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction transacao = null;//from ww w.java2 s. co m try { transacao = sessao.beginTransaction(); sessao.delete(autor); transacao.commit(); } catch (RuntimeException ex) { if (transacao != null) { transacao.rollback(); } throw ex; } finally { sessao.close(); } }
From source file:br.com.livraria.dao.FuncionarioDAO.java
public void excluir(Funcionario funcionario) { Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction transacao = null;// w w w . ja va2 s .c o m try { transacao = sessao.beginTransaction(); sessao.delete(funcionario); transacao.commit(); } catch (RuntimeException ex) { if (transacao != null) { transacao.rollback(); } throw ex; } finally { sessao.close(); } }
From source file:br.com.livraria.dao.ItemDAO.java
public void excluir(Item item) { Session sessao = HibernateUtil.getSessionFactory().openSession(); Transaction transacao = null;/*from w w w .j av a 2 s .c o m*/ try { transacao = sessao.beginTransaction(); sessao.delete(item); transacao.commit(); } catch (RuntimeException ex) { if (transacao != null) { transacao.rollback(); } throw ex; } finally { sessao.close(); } }