@Override
	public void update(Compra compra) {
		Compra compraAntiga = this.buscar(compra.getId());

		if(!compraAntiga.getContaCPF().equals(compra.getContaCPF())){
			compraAntiga.setContaCPF(compra.getContaCPF());
		}

		if(!(compraAntiga.getValor() == compra.getValor())){
			compraAntiga.setValor(compra.getValor());
		}

		String[] compraData = new String[3];
		compraData[0] = compraAntiga.getId();
		compraData[1] = compraAntiga.getContaCPF();
		compraData[2] = String.valueOf(compraAntiga.getValor());


		int index = 0;

		Iterator<Row> rowItr = compraSheet.rowIterator();
		while(rowItr.hasNext()){
			Row row = rowItr.next();
			if(row.getCell(0).getStringCellValue().equals(compra.getId())){
				Iterator<Cell> cells = row.cellIterator();
				while(cells.hasNext()){
					Cell cell = cells.next();
					if(index < 3){ //Index only updates until here.
						cell.setCellValue(compraData[index]); //As celas serao modificas com os valores novos encontrados em compra
						index++;
					}
				}
			}
		}
		FileOutputStream stream = null;
		try {
			stream = new FileOutputStream("planilha.xls"); 
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}



		try {
			wb.write(stream);
			stream.close();
		}catch(IOException e){

		}


	}