0 Replies Latest reply on Jun 15, 2011 8:46 PM by kwutzke

    Iteration and dynamic EntityQuery restrictions

    kwutzke

      I have a page with one ID as a URL param. What I need to do now is run a query to return a number of associated entities that basically need to get iterated over. Each of these instances becomes a tab in the GUI. For each of these entities I must run two kinds of queries sets each:


      1. For league-like round entities,
        1.1. run one query to determine the league standings (rankings)
        1.2. run one query to determine the schedule of games
      2. For elimination-like round entities,
        2.1. run one query to determine the outcome of each elimination round (best of 7 or whatever)
        2.2. run one query to determine the schedule of games
      


      This involves three different entity queries: standings query, schedule query, and a third yet to be created (2.1.). The problem here is: How do you parameterize each query with the current entity during iteration? How is it best done in Seam? How do I get another restriction or two into an EntityQuery dynamically?


          <rich:tabPanel>
            <c:forEach items="#{participationListQuery.resultList}" var="pa">
              <rich:tab label="#{...}" switchType="client">
                <h:panelGrid columns="2">
                  ...
                </h:panelGrid>
                <h:form>
                <rich:dataTable rendered="#{pa.group.round.isRankingRound()}"
                                id="standings"
                                value="#{rosterStandingsQuery.resultList}"
                                var="ssl"
                                width="100%"
                                rows="20">
                  ...
                </rich:dataTable>
                </h:form>
                <h:form>
                <rich:dataTable id="schedule-scores"
                                value="#{rosterScheduleQuery.resultList}"
                                var="sgl"
                                width="100%"
                                rows="20">
                  ...
                </rich:dataTable>
                </h:form>
              </rich:tab>
            </c:forEach>
          </rich:tabPanel>
      



      What's the general approach to use here? How do you parameterize rosterStandingsQuery and rosterScheduleQuery above?


      Best practices are always welcome, I'm still learning Seam.


      Thanks
      Karsten