0 Replies Latest reply on Jul 15, 2011 4:58 AM by giant2

    How to: selectOneMenu and hibernate

    giant2
      Hi!
      I (hope) use hibernate to populate a h:selectOneMenu.
      Hibernate (used from jbosstool) automatically create me:
      GroupE: Entity with id, description and other things
              named grupE
      GroupEList: EntityQuery making the select over the table
              named grpEList
      GroupEHome: EntityHome

      This selectOneMenu is populated during login in authenticator:
      @Out GroupEList grpEList;
      ...
      grpEList= new GroupEList();
      String query = "select GroupE from table as GroupE";
      grpEList.getEntityManager().createQuery(query).getResultList();

      This is the xhtml I use:
      <s:div rendered="#{not empty grpEList}">
      <h:outputLabel>Group </h:outputLabel>
      <h:selectOneMenu id="selectGroup" value="" required="true">
        <s:selectItems var="group" itemValue="#{grpE.id}" value="#{grpEList.resultList}" label="#{grpE.description}" />
        <s:convertEntity />
      </h:selectOneMenu>
      </s:div>

      I find there is one result (correct), but the combo isn't populated (there is only an empty element).

      Why this appens? Anyone knows?
      I use Seam 2.2.2Final and JBoss 4.2.3GA