5 Replies Latest reply on Mar 3, 2007 12:24 PM by gus888

    Questions on s:selectItems

    gus888

      Hi,

      It seems that s:selectItems has a bug. If I use "em" entity manager name in the components.xml:

      <core:managed-persistence-context name="em"
       persistence-unit-jndi-name="java:/cvnEntityManagerFactory"/>
      , and I used following code in converters class:
      return ((EntityManager) Component.getInstance("em")).find(
       Category.class, Integer.valueOf(arg2));

      then I got the entityManager is null exception. However, after I change "em" to "entityManager", exception disappeared. I have been using "em" for a little long time. Should I have to use "entityManger"?

      In addition, I ever read a posting which stated the s:selectItems currently doesn't support h:selectOneRadio. Is it correct? since I cannot get it work. Thanks. I use Seam CVS20070302

        • 1. Re: Questions on s:selectItems
          pmuir

           

          "gus888" wrote:
          I used following code in converters class:
          return ((EntityManager) Component.getInstance("em")).find(
           Category.class, Integer.valueOf(arg2));

          then I got the entityManager is null exception. However, after I change "em" to "entityManager", exception disappeared.


          I find this very hard to believe. By entityManager is null you mean you get an NPE? Or are you trying to use the entityconverter with this?

          In addition, I ever read a posting which stated the s:selectItems currently doesn't support h:selectOneRadio. Is it correct? since I cannot get it work.


          • 2. Re: Questions on s:selectItems
            gus888

            Hi Peter,

            Thank you for your reply. Yes, when I use "em" as persistent name, I got an exception "entityManager is null". Then I changed "em" into "entityManager" in components.xml, and also changed the converter code to:

            return ((EntityManager)Component.getInstance("entityManager")).find(Category.class, Integer.valueOf(arg2));
            then the exception disappeared.

            the s:selectItems currently doesn't support h:selectOneRadio.
            Sorry I made a stupid mistake, s:selectItems works in h:selectOneRadio. Thank you very much.

            • 3. Re: Questions on s:selectItems
              gus888

               

              "petemuir" wrote:
              Or are you trying to use the entityconverter with this?

              Peter, I exactly followed the ui example in Seam 1.2.0.
              1. added following code in components.xml:
              <framework:entity-query name="categories" ejbql="select c from Category c" />

              2. created Converters class, and added the convert code as same as the ui example.

              • 4. Re: Questions on s:selectItems
                pmuir

                 

                <framework:entity-query name="categories" ejbql="select c from Category c" entity-manager="#{em}"/>


                • 5. Re: Questions on s:selectItems
                  gus888

                  Thank you so much, Peter.

                  Gus