[jboss-user] [JBoss Seam] - Re: Is it a bug? EntityQuery refresh before update model
gledson.rabelo
do-not-reply at jboss.com
Thu Apr 26 10:02:31 EDT 2007
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>
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040989#4040989
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040989
More information about the jboss-user
mailing list