I'm working migrating a legacy software that use a lot of cases like <ui:repeat var="area" value="#{areaList.getResultList()}">
. Where getResultList()
executes a DB query. One of the problems is that when an ajax call is made, JSF at the phaseId 2 (APPLY_REQUEST_VALUES) visit all UIViewRoot
children, and executes this DB queries.
The question is, there is a way to avoid this? Is correct to think when the request is an ajax type, don't visit all children. Is a JSF / JSF 2 issue or Primefices issue? The migration also include JSF 1 to JSF 2 (Mojarra)
(I have zero chance to modify the way of value
is retrived)
UPDATE:
I'm using Wildfly 25.0.0 (it comes with jsf 2.3 by def) and JSF 2.1 Mojarra_2.1.29. But if you observe the stack when de ui:repeat is being accessed:
PartialViewContextImpl belong to JSF 2.3 (not mojarra_2.1.29) and there is where the original problem is, I think.
The strange is when the app starts, the log says:
INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 85) Inicializando Mojarra 2.1.29
I followed the next doc to configure a new JSF implementation on Wildfly: Link
UPDATE
I've extended UIRepeat and then solved my problem:
Thanks!