4
Updated: Link with a video that better exemplifies the situation.
I have a big problem, I’m having difficulties to update the database and display the updated data in 2 DataTables
different.
I have two pages, one is only visible to office worker Liberacao
and the other pro cargo Auditor
Page of the Liberation:
Page of the Auditor
I have a button grabs the selected object in each row. It opens a Dialog
which is carried by Bean
. On this page that opens I have the button Enviar auditoria
and Concluir Auditoria
When I Send the Audit it is edited in the database with the cargo
who sent it and the status
awaiting.
On the Release page in the table Auditorias Recebidas
is listed only what was sent by Auditor
and has the status Aguardando
. And on the Auditor’s page in "Received Audits is only listed what was sent by Liberação
and the status for Aguardando
.
The problem is as follows, when I have just performed a sending operation and return to the table even after pressing F5 several times the table does not update every time, sometimes it updates and sometimes not. I would like help to be able to update the database correctly:
Here is my method that does the research and fills my List on the Auditor 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 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 carrying the Auditor’s Mailed List, 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
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 filled with the current data, even the @postConstruct
and the <f:event>
with preRenderView
does not update the table immediately. And yet I still can’t find where the problem is.
How’s the page code? I’ve had a similar mt problem using
RichFaces
that would solve using theReRender
correctly– Maicon Carraro
How you populate the
listEnviados
?– Maicon Carraro
I will edit the question and put the method.
– DiegoAugusto
I did a test and if I wait about 20 seconds after the action and give an update the datatable updates correctly, IE, the line that was sent disappear, but only after 20, 25 seconds
– DiegoAugusto
I edited the question, I have a method of this in each bean, the only difference is in this line
listEnviados = solicitacaoDAO.listarEnviados("Auditor");
that changes toLiberacao
on the release screen– DiegoAugusto
Dude already had a problem with primefaces because of the browser cache. Try to clean up. And try adding a process="@this" and update to the table buttons.
– Rafael
all right, I’ll try
– DiegoAugusto
Didn’t work :/
– DiegoAugusto
@Can Techies post xhtml? You checked and the value is correctly persisted in the bank right after the right confirmation?
– Reginaldo Soares
Why don’t you put Controleauditoriaauditorbean as Requestscope? Have you debugged to see if the Controlauditorbean Search is called when sending an audit? Can be a simple ajax problem / request.
– Marllon Nasser
I tried, but the select button inside my datatable didn’t work. The only way to solve the problem I found was to make the "Sent" table on another screen. Now it’s worked
– DiegoAugusto
I know it has nothing to do with it but, which name of this template you’re using?
– adelmo00