Refresh the database correctly

4

Updated : Link with a video that best exemplifies the situation.

I have a big problem, I'm having trouble updating the database and displaying the updated data by 2% with% different.

I have two pages, one is visible to a position officer DataTables and the other one to charge Liberacao

Release Page:

Auditor'sPage

I have a button that grabs the selected object on each line. It opens a Auditor that is loaded by Dialog . On this page that I open I have the Bean and Enviar auditoria button When I send the audit it is edited in the database with Concluir Auditoria of who sent it and cargo waiting.

The Release page in the status table lists only what was sent by Auditorias Recebidas and has Auditor status. And on the Auditor page in "Audits Received, only what was sent by Aguardando and status%% of% is listed."

The problem is this, when I just perform a send operation and return to the table even after pressing f5 several times the table does not update every time, sometimes it updates and sometimes does not. I would like help with updating the database correctly:

Here is my method that does the search and fills my List on the Auditor's screen:

ManagedBean(name = "controleAuditoriaBean")
@ViewScoped
public class ControleAuditoriaAuditorBean {
private List<SolicitacoesBD> list;
private List<SolicitacoesBD> listEnviados;
@PostConstruct
    public void carregarPesquisa() {

        try {
            SolicitacoesDAO solicitacaoDAO = new SolicitacoesDAO();
            //Se o cargo for "Liberacao" e o Status for "Aguardando" faz a pesquisa.
            list = solicitacaoDAO.listarPorUsuario("Liberacao", "Aguardando");


            System.out.println("Caminho: "+solicitacoesBD.getCaminhoArquivo());
        } catch (RuntimeException ex) {

        }
    }
}

} And here's the one on the Liberation screen:

@ManagedBean(name = "controleAuditoriaLibBean")
@ViewScoped
public class ControleAuditoriaLiberacaoBean {
    private List<SolicitacoesBD> list;
    private List<SolicitacoesBD> listFiltrada;
    @PostConstruct
    public void carregarPesquisa(){
        try{
            SolicitacoesDAO solicitacaoDAO = new SolicitacoesDAO();
            list = solicitacaoDAO.listarPorUsuario("Auditor", "Aguardando");
            carregarEnviados();
        }catch(RuntimeException ex){
            FacesUtil.adicionarMsgErro("Erro ao tentar listar as Auditorias");
        }
    }
}

Method that loads list Sent from Auditor, the release is similar:

// mostra na tabela de baixo todos os dados enviados
    public void carregarEnviados() {
        try {
            SolicitacoesDAO solicitacaoDAO = new SolicitacoesDAO();
            listEnviados = solicitacaoDAO.listarEnviados("Auditor");

        } catch (RuntimeException ex) {
            FacesUtil.adicionarMsgErro("Erro ao tentar listar as Auditorias");
        }
    }

Updated

By doing some tests I realized that the list is not loaded "immediately" with the database data, it takes around 15 seconds until the list is populated with the current data, even Liberação and Aguardando com @postConstruct does not update the table immediately. And even then I still can not find where the problem is.

    
asked by anonymous 16.06.2015 / 14:52

1 answer

0

I tried a lot of things and nothing worked out, the only solution I found that worked was to remove% of Audits Sent from the same page as the ones received and created a separate%% to manage those pages. I do not know why but it worked.

UPDATED The problem was solved with only dataTable in the method that does the search, before I did not commit the queries of the bank.

    
29.06.2015 / 22:52