I'm debugging and I confirmed the behavior quoted.
I added a debug information in getResultList in the EntityQuery, in the HashMap
to discovery when the model is updated.
The model is updated after the querying of listing.
The console prints the information below:
| 20:43:12,562 INFO [STDOUT] Hibernate: select top ?
questionar0_.idQuestionario as idQuesti1_49_, questionar0_.exercicio as
exercicio49_, questionar0_.descricao as descricao49_,
questionar0_.restritoGestor as restrito4_49_,
questionar0_.tipoQuestionario_idTipoQuestionario as tipoQues5_49_ from
Questionario questionar0_ order by questionar0_.descricao
| 20:43:12,562 INFO [STDOUT] GETTING RESULT LIST
| 20:43:12,562 INFO [STDOUT] CALL GET SELECTION
|
| ...
|
| 20:43:12,734 INFO [STDOUT] Hibernate: select count(*) as col_0_0_ from
Questionario questionar0_
|
| ....
|
| 20:43:12,765 INFO [STDOUT] GETTING RESULT LIST
| 20:43:14,656 INFO [STDOUT] PUT 13 - false
| 20:43:14,671 INFO [STDOUT] PUT 14 - false
|
My JSP
| <body>
|
| <div class="body">
|
| <h1>Questionário - Pesquisa</h1>
|
| <h:form id="searchform">
|
| <h:messages styleClass="message" />
|
| <!-- search box -->
|
| <div class="dialog">
|
| <span class="prop">
|
| <span class="name">Descricao:</span>
| <span class="value"><h:inputText
value="#{questionarioSearch.descricao}" /></span>
| </span> <br/>
|
| <span class="prop"> <span class="name">Exercicio :</span>
|
| <span class="value"><h:inputText
value="#{questionarioSearch.exercicio}" /> </span> </span> <br/>
|
| <div class="actionButtons">
|
| <s:link view="/searchQuestionario.xhtml"
value="Pesquisar" />
|
| <s:link view="/editQuestionario.xhtml" value="Incluir"
/></div>
| </div>
|
| <!-- 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 EntityQuery
|
|
| public class FramexEntityQuery extends EntityQuery {
|
| @RequestParameter
| private String querySorting;
|
| @RequestParameter
| private Integer firstResult;
|
| @Override
| public String getOrder() {
| if (querySorting != null) {
| setOrder(querySorting);
| }
| return super.getOrder();
| }
|
| @Override
| public Integer getFirstResult() {
| if (firstResult != null) {
| setFirstResult(firstResult);
| }
| return super.getFirstResult();
| }
|
| @Override
| @Transactional
| public List getResultList() {
| List list = super.getResultList();
| System.out.println("GETTING RESULT LIST");
| return list;
| }
|
|
My EntityHome
| public class FramexEntityHome<E> extends EntityHome<E> {
|
| private static final long serialVersionUID = -1322828158520981636L;
|
| @Override
| public Object getId() {
| return super.getId();
| }
|
| Map<Object, Boolean> selection = new CustomHashMap<Object, Boolean>();
|
| //@Out(scope=ScopeType.EVENT)
| public Map<Object, Boolean> getSelection() {
|
| System.out.println("CALL GET SELECTION");
| for (Object id : selection.keySet()) {
| System.out.println("---> " + id + ":" +
selection.get(id));
| }
|
|
| return selection;
| }
|
| public void setSelection(Map<Object, Boolean> selection) {
| System.out.println("CALL SET SELECTION");
| for (Object id : selection.keySet()) {
| System.out.println("---> " + id + ":" +
selection.get(id));
| }
| 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));
| }
| }
| }
|
|
My CustomHashMap
|
| public class CustomHashMap<K,V> extends HashMap<K,V> {
|
| @Override
| public V put(K key, V value) {
| System.out.println("PUT " + key + " - " + value);
| return super.put(key, value);
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040745#4040745
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040745
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user