예제 #1
0
  public void deletar(Produto produto) {
    try {
      conexao = Conexao.abrirConexao();

      /*
      if (this.getSchema()!=null && this.getSchema().equals("")) {
          Statement stm = conexao.createStatement();
          stm.execute("SET SCHEMA = "+this.getSchema());
      }
      */

      PreparedStatement ps = conexao.prepareStatement("delete from PRODUTO where IDPRODUTO = ?");

      ps.setInt(1, produto.getIdProduto());

      ps.executeUpdate();
      ps.close();
      conexao.close();
    } catch (SQLException ex) {
      Logger.getLogger("DaoProduto").log(Level.SEVERE, "SQLException: {0}", ex.getMessage());
    }
  }