0
I have a dataTable and in the last column I have an edit button that opens a dialog with a field to be filled. When I click edit the table is updated with the edited data, but if I give an F5 the old data comes back to dataTable.
Edit method in bean:
public void pausarTarefa(){
        System.err.println("Pausar");
        try {
            tarefa.setStatus("Pausado");
            tarefa.setDataFim(new Date());
            TarefaDAO tarefaDAO = new TarefaDAO();
            tarefaDAO.editar(tarefa);   
            FacesUtil.adicionarMsgInfo("Tarefa Pausada com Sucesso");
            tarefa = new Tarefa();
        } catch (RuntimeException e) {
            FacesUtil.adicionarMsgErro("Erro ao Pausar Tarefa");
            e.printStackTrace();
        }
    }
Method that fills the list used in the datatable:
@PostConstruct
public void listar() {
    listaTarefa = new ArrayList<>();
    System.err.println("Metodo Listar");
    try {
        TarefaDAO tarefaDAO = new TarefaDAO();
        listaTarefa = tarefaDAO.listarPorUsuario(usuarioBean
                .getUsuarioLogado());
    } catch (RuntimeException e) {
        FacesUtil.adicionarMsgErro("Erro ao listar tarefas: "+e.getMessage());
    }
}
The scope of the bean is ViewScoped.
In the database the data is correct after editing, it is only the datatable that brings the old data. Someone can help?
Datatable:
p:dataTable value="#{tarefaBean.listaTarefa}" id="tarefaTable"
                var="tarefa" style="margin-top: 20px"
                emptyMessage="Nenhuma Tarefa Encontrada. " rows="10"
                paginator="true" paginatorAlwaysVisible="false"
                paginatorPosition="botton">
Post the code of your datatable (only her statement).
– Rafael
I edited the question with the code
– Diego