How to improve ajax update ? JSF performance

Asked

Viewed 182 times

0

I am developing a system for restaurant and I have a datagrid that updates the other.
For example: I click on the class and update the product datagrid.

It works, but the result is slow.

I’m wearing a <h:commandLink> with update:

<p:commandLink  actionListener="#{mesaControle.setClasseFiltro(grupo)}"
                action="#{mesaControle.validaBuscarProduto()}" 
                update="form:produtos">
    <button style="background-color: #0b66b1; height: 55px; width: 100px;">
    <br/>
    <strong style="color: #f6f6f6">#{grupo.nome}</strong></button>
</p:commandLink>

And filter as follows:

public List<Produto> listaClasse(Classe produtoFiltro) {
    Query q = em.createQuery("FROM Produto As a WHERE a.classe = :para order by id asc");
    q.setParameter("para", produtoFiltro);
    return q.getResultList();
}

Everything works perfectly, but the performance leaves to be desired.
How can I improve performance?

  • What does it take? Query in database or update component in view?

  • Guy is probably updating the component in the view, I need something dynamic, something that when I click the button, it already renders on the side.. At the moment it takes 2 to 3 seconds after the click .

  • Puts a System.out.println() at the beginning and end of the method of consulting the bank and compare if one takes longer than the other... I think that’s what is holding up hehe

  • 1

    beauty I will try and put and result

  • guy, being the research that is slowing down you know some other way he does this research] I noticed that in the class that has more products it takes a little longer.

  • 1

    You knew it! Hehe. Dude, in this case there are a few things you can do: create index for your table (if it doesn’t exist yet), limit the amount of records searched per datagrid page, and I don’t think you need to do FROM Produto As a. I guess just FROM Produto a already works (not that that’s the problem)

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.