5 Replies Latest reply on Jan 8, 2009 10:28 PM by valatharv

    Implementing framework entity query in components.xml question, suggestion reqd

    valatharv
      Hi,

      I am trying to implement framework entity query in components.xml first time. Need some information...

      I have an entity "Project", seam gen created corresponding ProjectList.java which extends EntityQuery.

      a) If we usign "framework:entity-query" then I cannot not use ProjectList.java ?? else I get "Two components with the same name and precedence " exception....

      b) I tried testing a simple query to components.xml (removed ProjectList.java generated by seam),
      when I try to access page it gives the error as mentioned below:

      I am sure I am missing some configuration... please suggest.

      Error :
      -------
      javax.servlet.ServletException: Property 'project' not found on type org.jboss.seam.framework.EntityQuery_$$_javassist_5
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

      Components.xml:
      ---------------
      <framework:entity-query name="projectList"
        ejbql="select project from Project project" scope="conversation">
        <framework:hints>
        <key>org.hibernate.comment</key>
        <value>Query for projects as result of search on /ProjectList.xhtml</value>
        </framework:hints>

        <framework:restrictions>
        <value>project.hjid=7</value>
        </framework:restrictions>

      </framework:entity-query>

      ProjectList.xhtml
      -----------------
      <rich:dataTable id="projectList"
        var="project"  value="#{projectList.resultList}"
         rendered="#{not empty projectList.resultList}">

      <h:column>
      #{project.projectName}
      </h:column>
      ... etc..
        • 1. Re: Implementing framework entity query in components.xml question, suggestion reqd
          valatharv
          Any suggestion on above issue, I tried various options but still getting exception....

          "Property 'project' not found on type org.jboss.seam.framework.EntityQuery_$$_javassist_5"

          Looks like mising some basic configuration.
          • 2. Re: Implementing framework entity query in components.xml question, suggestion reqd
            nicolas.bielza

            a) This is because you defined two components with the same name and precedence ! The name of a component is not related to its Java class name: when defining the component in components.xml, the name is defined in the name attribute, when defining the component in Java code, it is defined in the @Name annotation.


            b) Usually, I get this error message when I set



            value="#{projectList}"




            instead of



            value="#{projectList.resultList}"


            • 3. Re: Implementing framework entity query in components.xml question, suggestion reqd
              valatharv
              Thanks for replying...

              For the sake of simplicity, I am just using a simple query in components.xml for Project entity, but I get this error.. where I am doing wrong, please help

              -----------------------------------------
              javax.el.PropertyNotFoundException: Property 'project' not found on type org.jboss.seam.framework.EntityQuery_$$_javassist_5
              -----------------------------------------

              Components.xml
              --------------
              Just added this...
              <framework:entity-query name="projectList"
                   ejbql="select project from Project project" scope="conversation">
              </framework:entity-query>

              ProjectList.xhtml
              -----------------
              <rich:dataTable id="projectList"
                              var="project"
                            value="#{projectList.resultList}"
                         rendered="#{not empty projectList.resultList}">
              <h:column>
                  <f:facet name="header">
                   <s:link styleClass="columnHeader"
                           value="Project Name #{projectList.order=='projectName asc' ? messages.down :
                              ( projectList.order=='projectName desc' ? messages.up : '' )}">
                       <f:param name="order" value="#{projectList.order=='projectName
                                asc' ? 'projectName desc' : 'projectName asc'}"/>
                   </s:link>
                  </f:facet>
                  #{project.projectName}
              </h:column>
              .....
              </rich:dataTable>
              • 4. Re: Implementing framework entity query in components.xml question, suggestion reqd
                nicolas.bielza

                Can you post the complete stacktrace ?

                • 5. Re: Implementing framework entity query in components.xml question, suggestion reqd
                  valatharv

                  Thanks for your time Nicolas, I used ProjectList.java generated by seam(looks like it is required) and changed the component name in components.xml, it seems to be fine as of now.


                  Thanks