5 Replies Latest reply on Feb 23, 2010 12:39 AM by Alexander Kudryavtsev

    Pass EntityQuery object to EntityHome's method (help needed)

    Alexander Kudryavtsev Newbie

      Hello,
      I'm using EntityQuery and EntityHome to develop my application.
      I have a page with a result of the EntityQuery - it is a table with possibility of check (as checkboxes) some rows to be treated by the EntityHome's method.
      EntityHome has a field like:


      @In MyEntityQuery mq;


      which is suppose to be linked to the result.
      The method takes mq to traverse the result set by using mq.getResultSet()


      On the .xhtml form a special button invokes this method.
      Unfortunately, it gives an exception Can't instantiate an object because mq is null.


      What is the best practice to tackle with such a routine?
      Should I change the scope type of the EntityQuery class to CONVERSATION?


      Any help would be appreciated.


      Thanks.

        • 1. Re: Pass EntityQuery object to EntityHome's method (help needed)
          Ilya Dyoshin Novice

          the best solution is to deal with @DataModel and @DataModelSelection annotations.


          But we can tell you more if you'll post your stack.



          Regards,


          Ilya Dyoshin

          • 2. Re: Pass EntityQuery object to EntityHome's method (help needed)
            Alexander Kudryavtsev Newbie

            In fact, I tried to use another name for the variable at @In that it repeats in exact the paramaeter in annotation for the EntityQuery (@Name(mq)) but, it was not working...


            So the questions :
            1) How SEAM searches the name used in @In ?
            2) How to activate SEAM traces?
            3) I seen some reports that @DataModel doesn't work good with QueryEntity


            BTW,
            I did a small workaround : I avoid using EntityQuery directly but, use the getResultList() to pass it as a parameter to my EntityHome method.
            It works but, I don't think it is SEAM minded solution.


            Another small question. Why is SEAM so creepy? It takes enormous time to get simple things!!1111


            Stack:




            JBoss Seam Debug Page
            This page allows you to browse and inspect components in any of the Seam contexts associated with the current session. It also shows a list of active, long-running conversations. You can select a conversation to view its contents or destroy it. 
            ConversationsConversation ID    Nested? Activity        Description     View ID Action
            5       false   12:13:09 - 12:14:13             /debug.xhtml    Select Destroy
            
            -  Component (None selected) 
            Select a component from one of the contexts below 
            -  Conversation Context (5) entityManager
            entityManagerDerby
            entityManagerMysql
            invoicingLabelIssueList
            org.jboss.seam.caughtException
            org.jboss.seam.core.conversation
            org.jboss.seam.faces.redirect
            org.jboss.seam.handledException
            org.jboss.seam.international.statusMessages
            org.jboss.seam.persistence.persistenceContexts
            pointageFileHome
            projectsHome
            timeEntriesHome
            
            -  Business Process Context 
            Empty business process context
            -  Session Context dynamicEntityManager
            javax.faces.request.charset
            org.ajax4jsf.application.AjaxStateHolder
            org.ajax4jsf.application.AjaxStateManager.view_sequence
            org.jboss.seam.core.conversationEntries
            org.jboss.seam.international.localeSelector
            org.jboss.seam.international.timeZoneSelector
            org.jboss.seam.security.credentials
            org.jboss.seam.security.identity
            org.jboss.seam.security.rememberMe
            org.jboss.seam.security.ruleBasedPermissionResolver
            org.jboss.seam.web.session
            
            +  Application Context 
            -  Exception 
            Exception during request processing: 
            Caused by javax.servlet.ServletException with message: "/TimeEntriesEdit.xhtml @71,73 value="#{timeEntriesHome.instance.projectId}": Property 'projectId' not found on type com.pcsol.redmine.entities.TimeEntries" 
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:51)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
            org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
            org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
            org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:619)
            Caused by javax.el.PropertyNotFoundException with message: "/TimeEntriesEdit.xhtml @71,73 value="#{timeEntriesHome.instance.projectId}": Property 'projectId' not found on type com.pcsol.redmine.entities.TimeEntries" 
            com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
            javax.faces.component.UIOutput.getValue(UIOutput.java:184)
            com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
            com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284)
            com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154)
            javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
            org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:190)
            org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
            org.jboss.seam.ui.renderkit.ValidateAllRendererBase.doEncodeChildren(ValidateAllRendererBase.java:33)
            org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
            javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
            org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:186)
            org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
            org.jboss.seam.ui.renderkit.DecorateRendererBase.doEncodeChildren(DecorateRendererBase.java:146)
            org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
            javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
            org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
            org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
            org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:220)
            org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:215)
            org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
            javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
            javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
            javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
            javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
            javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
            javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
            com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
            org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
            org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
            com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
            com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
            com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:51)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
            org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
            org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
            org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:619)



            Merci.

            • 3. Re: Pass EntityQuery object to EntityHome's method (help needed)
              Alexander Kudryavtsev Newbie

              Oh sorry, it is a new stack!!!
              Old one is not available!!!111

              • 4. Re: Pass EntityQuery object to EntityHome's method (help needed)
                Ilya Dyoshin Novice

                Well If you find SEAM to creepy - solve your problems in not creepy environment ;)


                if you use annotation to inject your components simply add value-expression of your component:  @In(create=true, value="#{myGreatComponent}") Once your project grows you realize that it would be better to pack components in to the packages, and thus there would be no possibility to inject by naming convention (point isn't allowed in variable name),



                And unless you provide the exact trace with your problem - we can't help.



                Regards,


                Ilya Dyoshin

                • 5. Re: Pass EntityQuery object to EntityHome's method (help needed)
                  Alexander Kudryavtsev Newbie

                  Thank you!



                  |@In(create=true, value="#{myGreatComponent}")|




                  really works!!!!!!!!!!!!!!1111111111111