4 Replies Latest reply on Jan 21, 2008 5:50 AM by pmuir

    EntityQuery and Icefaces

    marthoff

      Hello,

      i've a problem using the EntityQuery in page Scope. If the Scope of an EntityQuery extending class is set to Page an exception occurs saying that the dataModel can't be found. Has anyone of you experience in using EntityQuery and icefaces components? It would be very helpful to find a working example, which uses all features like pagination, row selection and filters.

      Thanks
      Martin

        • 1. Re: EntityQuery and Icefaces
          marthoff

          Hello again,

          i found a solution for the problem (maybe).

          First the concrete Exception is:

          Caused by: javax.el.ELException: /client/claim_list.xhtml @16,52 value="#{testLi
          st.dataModel}": Error reading 'dataModel' on type de.iseki.garantieext.card.Test
          List_$$_javassist_0
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.ja
          va:76)
           at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
           ... 69 more
          Caused by: java.lang.IllegalStateException: EntityManager is closed
           at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java
          :42)


          So the reason was the closed EntityManager. My solution is to add:

          @In private EntityManager entityManager;
          
          @Override
          public EntityManager getEntityManager() {
           return entityManager;
          }
          


          Do you think that it is good solution? Why is the EntityManager fetched in such a complicated way by the EntityQuery class (by using the PersistentContext)?

          • 2. Re: EntityQuery and Icefaces
            pmuir

            The EntityQuery isn't designed to be used with the PAGE context.

            • 3. Re: EntityQuery and Icefaces
              marthoff

              Hello,

              wouldn't it be preferable to use the EntityQuery within the PAGE scope? The seam reference says about the PAGE context:

              This is especially useful for functionality like clickable lists, where the list is backed
              by changing data on the server side.


              So the EntityQuery is the best suited class to manage data from the db on the server?

              On the other hand it would be nice if the documentation says which framework class can be used in which context.

              Greets,
              Martin

              • 4. Re: EntityQuery and Icefaces
                pmuir

                 

                wouldn't it be preferable to use the EntityQuery within the PAGE scope?


                The EntityQuery isn't designed to be used with the PAGE context.


                On the other hand it would be nice if the documentation says which framework class can be used in which context.


                Open a JIRA issue.