Jtable pegandos dados inexistentes

0 respostas
L

Pessoal sou iniciante em java, eu criei uma jtable puxando dados do banco oracle, porem mesmo depois de apagar os dados do oracle a jtable continua puxando esse dados que não existem no banco. Esse codigo ele atualiza quando insere um novo cadastro porem continua os dados antigos. :(

codigo:

// METODO PARA PEGAR TODOS OS DADOS DA TABELA
    public ArrayList PegarDados() 
    {
     PreparedStatement pstmt;
     ResultSet rs;
     
     String SQL_SELECT = "SELECT IDE,NOME,CPF,RG,EMAIL FROM CLIENTE ORDER BY IDE";
     ArrayList dados = new ArrayList();     
     try
     {
      pstmt = connection.prepareStatement(SQL_SELECT);
      rs = pstmt.executeQuery();
      while(rs.next())
      {
      dados.add(new Object[]{rs.getString("IDE"),rs.getString("NOME"),rs.getString("CPF"),
                rs.getString("RG"),rs.getString("EMAIL")});      
      }
     return dados;
     }
     catch(SQLException eSQL)
     {
         JOptionPane.showMessageDialog(null,"Erro !!!\nClasse: "+getClass()+"\nTipo: "+eSQL.getMessage());
         
     }
     return null;
    }
    // FIM DO METODO PEGAR DADOS

public class ModeloTabela extends AbstractTableModel // CLASSE MODELO
{
    private ArrayList linhas = null; // ATRIBUTOS
    private String[] colunas = null; // ATRIBUTOS

    public ModeloTabela(ArrayList linhas, String[] colunas) // CONSTRUTOR DA CLASSE TABLEMODEL
    {
        setLinhas(linhas);
        setColunas(colunas);
    }
     
    //SETS
    public void setLinhas(ArrayList dados)
    {
        this.linhas = dados;
    }
    
    public void setColunas(String[] col)
    {
        this.colunas = col;
    }
    //SETS
    //GETS
    public ArrayList getLinhas()
    {
        return this.linhas;
    }
    
    public String[] getColunas()
    {
        return this.colunas;
    }
    //GETS
    
    @Override
    public int getColumnCount() 
    {
     return colunas.length;    
    }
    
    @Override
    public int getRowCount() {
        return linhas.size();
    }
    
    public String getColumnName(int numCol)
    {
        return this.colunas[numCol];
    }
    
    @Override
    public Object getValueAt(int numLin, int numCol) {
        Object[] linha = (Object[]) getLinhas().get(numLin);
        return linha[numCol];
    }
}// FIM DA CLASSE
Criado 28 de junho de 2014
Respostas 0
Participantes 1