@Override
 public void cadastrar(Contato contato) throws Exception {
   sql = new StringBuilder();
   sql.append("insert into Contato (nmContato, nmCaminhoFoto, nmLogin)\n");
   sql.append("values (?, ?, ?)");
   try {
     cn = FabricaDeConexao.getConnection();
     stmt = cn.prepareStatement(sql.toString());
     stmt.setString(1, contato.getNmContato());
     stmt.setString(2, contato.getNmCaminhoFoto());
     stmt.setString(3, contato.getNmLogin());
     System.out.println(stmt);
     stmt.execute();
   } catch (SQLException e) {
     throw e;
   } finally {
     fecharConexoes();
   }
 }
 @Override
 public void alterar(Contato oldContato, Contato newContato) throws Exception {
   sql = new StringBuilder();
   sql.append("update Contato set\n");
   sql.append("nmContato=?,\n");
   sql.append("nmCaminhoFoto=?,\n");
   sql.append("nmLogin=?\n");
   sql.append("where cdContato=? and nmLogin=?");
   try {
     cn = FabricaDeConexao.getConnection();
     stmt = cn.prepareStatement(sql.toString());
     stmt.setString(1, newContato.getNmContato());
     stmt.setString(2, newContato.getNmCaminhoFoto());
     stmt.setString(3, newContato.getNmLogin());
     stmt.setInt(4, oldContato.getCdContato());
     stmt.setString(5, oldContato.getNmLogin());
     System.out.println(stmt);
     stmt.execute();
   } catch (SQLException e) {
     throw e;
   } finally {
     fecharConexoes();
   }
 }