I created a REST Web Service in Java. All operations are working less than DELETE which returns the following error:
HTTPDELETEmethod:
@DELETE@Path("excluir/{idpromocao}")
public void excluir(@PathParam("idpromocao") int idpromocao){
Promocao P = new Promocao();
P.setIdpromocao(idpromocao);
PromocaoOp promo = new PromocaoOp();
P = promo.buscar(P);
promo.remove(P);
}
Exclusion Method:
public void remove(Promocao promocao) {
id_conexao = N.Conectar();
String sql = "delete from promocao where idpromocao=?";
try {
stmt = id_conexao.prepareStatement(sql);
stmt.setInt(1, promocao.getIdpromocao());
//executa
stmt.execute();
System.out.println("Excluido");
} catch (SQLException e) {
System.err.println("ERRO ao excluir promoção - " + e);
} finally {
N.Desconectar();
}
}