4 Replies Latest reply on Nov 17, 2008 6:51 PM by Dmitry Shultz

    Seam 2.1 & Glassfish & selectOneMenu

    Thierry Rietsch Newbie
      Hi

      I'm fighting with a dropdown list problem :-) I would like to have a simple drow down menu, filled with entities. I found a lot of examples in the internet about this, so there is no doubt that this must work :-) Unfortunately it looks like using this on glassfish isn't as easy as using it on a JBoss application server.

      What I've configured so far:

      components.xml
      <persistence:managed-persistence-context name="em" auto-create="true" persistence-unit-jndi-name="java:comp/env/demo/emf" />
      <ui:jpa-entity-loader entity-manager="#{em}" />

      <transaction:ejb-transaction />

      persistence.xml
          <persistence-unit name="demoPU">
              <provider>org.hibernate.ejb.HibernatePersistence</provider>
              <jta-data-source>jdbc/__default</jta-data-source>
              <properties>
               <!-- The following two properties are for Glassfish -->
                  <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
                  <property name="hibernate.hbm2ddl.auto" value="update"/>
                  <property name="hibernate.show_sql" value="true"/>
                  <property name="hibernate.transaction.flush_before_completion" value="true"/>
                  <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
              </properties>
          </persistence-unit>

      web.xml
          <ejb-local-ref>
              <ejb-ref-name>Demo/EjbSynchronizations/local</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
              <ejb-link>EjbSynchronizations</ejb-link>
          </ejb-local-ref>
          <persistence-unit-ref>
              <persistence-unit-ref-name>demo/emf</persistence-unit-ref-name>
              <persistence-unit-name>demoPU</persistence-unit-name>
          </persistence-unit-ref>

      xhtml page:
      <h:selectOneMenu value="#{offerPosition.product}">
              <s:selectItems value="#{products}" var="prod" label="#{prod.name}" noSelectionLabel="Please Select..." />
              <s:convertEntity />
      </h:selectOneMenu>

      For the seam component I have defined a stateful bean which has a conversation scope. The data collection in the background is a linked list which is annotated with @out(required=false) and has a related factory method which fills the collection with data.


      This all gets deploy over a NetBeans Enterprise Project (EAR which contains an ejb-jar and a war). When I now open the page i don't get an error message but I don't see any drop down control on the site. It's just empty. Did I miss something in the configuration? I am getting crazy about this :-)

      Thanks a lot for your help,
      Thierry