-
1. Re: Is it a bug? EntityQuery refresh before update model
pmuir Apr 26, 2007 9:27 AM (in response to gledson.rabelo)We've fixed that bug by now (1.2.1.GA will have the fix). I did fix a very similar one earlier this week. Post your jsf, the relevant part of components.xml and what the "undesirable effects" actually are.
-
2. Re: Is it a bug? EntityQuery refresh before update model
gledson.rabelo Apr 26, 2007 10:02 AM (in response to gledson.rabelo)Hi Pete, Thanks for your reply.
I'm using 1.2.1.GA.
I'm using pagination with selectable rows. When I go to the next page, I want send to the back bean the rows selected in the current page.
But, the refresh of query is performed before of update the back bean and it's receive data of next page (because the EntityQuery refresh
already occurred).
I will go to illustrate with an example:
Current Page Rows:
Marked Value
false value1
true value2
true value3
false value4
When I submit and go to the next page the refresh is first performed returning values (value5, value6, value7, value8) and after the model is updated with the values below and the next page is shown:
Marked Value
false value1
true value2
true value3
false value4
So, probably had the premature EntityQuery refresh , the model is updated incorrectly.
My Code is Listed below:
My XHTML:<body> <h:form id="searchform"> ..... <!-- search results --> <rich:dataTable value="#{questionarios.resultList}" var="questionario" id="table"> <f:facet name="header"> <rich:columnGroup> <rich:column> Seleção </rich:column> <rich:column> <h:commandLink value="-" > <f:param name="querySorting" value="descricao" /> </h:commandLink> <h:outputText value="Descrição" /> </rich:column> <rich:column> <h:commandLink value="-" > <f:param name="querySorting" value="exercicio" /> </h:commandLink> <h:outputText value="Exercício" /> </rich:column> </rich:columnGroup> </f:facet> <rich:column> <h:selectBooleanCheckbox value="#{questionarioHome.selection[questionario.idQuestionario]}" /> </rich:column> <rich:column> <s:link view="/viewQuestionario.xhtml" value="#{questionario.descricao}"> <f:param name="questionarioId" value="#{questionario.idQuestionario}" /> </s:link> </rich:column> <rich:column> <h:outputText value="#{questionario.exercicio}" /> </rich:column> </rich:dataTable> <h:outputText value="Não há questionários para seram exibidos." rendered="#{empty questionarios.resultList}" class="message" /> <div class="tableControl"> <h:outputText value="Total de Registros: ${questionarios.resultCount}" /> <!-- Pagination Buttons --> <h:commandLink value="<<" rendered="#{questionarios.previousExists}"> <f:param name="firstResult" value="0" /> <f:param name="querySorting" value="#{questionarios.order}" /> </h:commandLink> <h:commandLink value="<" rendered="#{questionarios.previousExists}"> <f:param name="firstResult" value="#{questionarios.previousFirstResult}" /> <f:param name="querySorting" value="#{questionarios.order}" /> </h:commandLink> <h:commandLink value=">" rendered="#{questionarios.nextExists}"> <f:param name="firstResult" value="#{questionarios.nextFirstResult}" /> <f:param name="querySorting" value="#{questionarios.order}" /> </h:commandLink> <h:commandLink value=">>" rendered="#{questionarios.nextExists}"> <f:param name="firstResult" value="#{questionarios.lastFirstResult}" /> <f:param name="querySorting" value="#{questionarios.order}" /> </h:commandLink> </div> <div class="actionButtons"> <!-- Delete Button --> <h:commandLink action="#{questionarioHome.removeChecked}" value="Excluir" > <f:param name="firstResult" value="0" /> <f:param name="querySorting" value="#{questionarios.order}" /> </h:commandLink> </div> </h:form> </div> </body>
My EntityHome:public class FramexEntityHome<E> extends EntityHome<E> { Map<Object, Boolean> selection = new CustomHashMap<Object, Boolean>(); public Map<Object, Boolean> getSelection() { return selection; } public void setSelection(Map<Object, Boolean> selection) { this.selection = selection; } public void removeChecked() { System.out.println("CALL REMOVE CHECKED"); if (selection != null) { System.out.println("### SIZE ###" + selection.keySet().size()); for (Object id : selection.keySet()) { System.out.println("---> " + id + ":" + selection.get(id)); } } }
and my componentes.xml<factory name="questionario" value="#{questionarioHome.instance}" /> <fxfwk:framex-entity-home name="questionarioHome" entity-manager="#{questionarioEntityManager}" entity-class="br.gov.cgu.ativa.questionario.entidade.Questionario" /> <fwk:entity-query name="questionarios" max-results="3" entity-manager="#{questionarioEntityManager}"> <fwk:ejbql>from Questionario</fwk:ejbql> <fwk:restrictions> <value> lower(descricao) like lower( '%' + #{questionarioSearch.descricao} + '%' ) </value> <value>exercicio = #{questionarioSearch.exercicio}</value> </fwk:restrictions> <fwk:order>descricao</fwk:order> </fwk:entity-query>
-
3. Re: Is it a bug? EntityQuery refresh before update model
gledson.rabelo Apr 26, 2007 12:16 PM (in response to gledson.rabelo)I modified the contactlist example to be more easy to analyze the problem.
If somebody will be able to help me will be very grateful.
The url to the file modified example is:
http://gledson.googlepages.com/contactlist-queryrefresh_before_upda.zip
I'm thinking that is a bug but I am not certain. -
4. Re: Is it a bug? EntityQuery refresh before update model
gledson.rabelo Apr 27, 2007 8:37 AM (in response to gledson.rabelo)I solved the problem and I am giving feedback who to need in the future.
It's not a Seam Problem or Bug. It's a JSF behavior.
In the Appply Request Values the JSF the current state of each component is retrivied.
In the retrieve of the state of the data table, it's need get the current data and call the refresh entity query.
I solved the problem putting the Entity Query in the PAGE scope.
Thanks for helps.
Gledson -
5. Re: Is it a bug? EntityQuery refresh before update model
pmuir Apr 27, 2007 9:36 AM (in response to gledson.rabelo)Glad you got this sorted out, but I still feel it needs some investigation - you shouldn't have to alter the scope of EntityQuery to make it work! I hadn't noticed that you were using a h:commandLink rather than an s:link - I suspect this may be why it didn't work quite as expected.