1 Reply Latest reply on Sep 21, 2009 2:14 PM by Shervin Asgari

    Using <framework:entity-query> for populating <s:selectItems>

    Ambrish Singh Newbie

      Hi Everyone,


      I have written an Entity Query in components.xml file as shown below:




      <framework:entity-query name="rolesLists"
                      ejbql="select r from UserRole r" />




      and then I am populating an <s:selectItems> list with this rolesList as shown here :





      <h:selectOneMenu value="#{userAction.userRole}" required="true" >
      <s:selectItems value="#{roleLists.resultList}" var="role"
      label="#{role.strTitle}" noSelectionLabel="#{messages.defaultListItem}" />   <s:convertEntity />
      </h:selectOneMenu>



      Now my problem is that when the page is load, then the userAction.getUserRole() method is called as many times as the items in the select list, i.e; the size of rolesLists.


      getUserRole() method returns an Entity of type UserRole.


      What should I do so that the getUserRole() method is called once.?


      Any help would be appreciated.




      Thanks & Regards


      Ambrish