2 Replies Latest reply on Aug 6, 2009 11:18 AM by Leo van den berg

    extra queries from s:selectItems and s:convertEntity?

    Jeff Faath Newbie

      Hello, I'm new to Seam so learning as I'm going.  By following examples (mainly, the UI selectItems example), I've gotten these components to work just fine, but I was curious as to what is happening behind the scenes since extra queries are being called.  I simply have several select boxes similar to this:


      <div class="entry">
        <div class="label"><h:outputLabel for="country">Country:</h:outputLabel></div>
        <div class="input">
          <s:decorate>
            <h:selectOneMenu id="country" value="#{item.country}">
              <s:selectItems var="country" value="#{countries.resultList}" label="#{country.country}" noSelectionLabel="Please select..."></s:selectItems>
              <s:convertEntity />
            </h:selectOneMenu>
          </s:decorate>
        </div>
      </div>
      



      Looking at the generated HTML, it looks like a new Id value is created for each item.  That's fine, since it works OK, but what is odd is that if I set the field, whenever I move around to other fields, two select queries are being called.  One is essentially returning all the countries, and another is returning a country for a given Id (viewing the Hibernate output).


      I have 4 similar select boxes on this form, so if I've used all of them, when I'm moving to other fields, 8 queries are being called.  This seems unnecessary...perhaps I'm doing something wrong?  I've followed the examples to a tee.  Hopefully someone can enlighten me?


      Regards,


      JF