I have a simple delete method, it gets the id from a table that lists all from the db:
@RequestMapping(value = "/personagem/excluir.htm") public ModelAndView doExcluir(@RequestParam("id") int id) { logger.info("Recebendo parametro: {Id => " + id + "}"); try { Personagem p = getPersonagemService().buscarPorId(id); logger.info("Excluindo personagem: {Id => " + p.getId() + ", Nome => " + p.getNome() + ", Classe => " + p.getClasse() + "}"); getPersonagemService().excluir(p); return new ModelAndView("excluir"); } catch (Exception ex) { return new ModelAndView("erro", "mensagem", "Ocorreu um erro: " + ex); } } And heres the delete method from my dao:
public void excluir(Object obj) { getSession().beginTransaction(); getSession().delete(obj); getSession().flush(); getSession().close(); } I click the delete button, that call for the doExcluir() method, that should delete the data. It comes back to the list page, as it should, but it just wont remove the data from the table. Did i do anything wrong?