5 Replies Latest reply on Jun 17, 2008 5:28 AM by scott duke

    Displaying thousands of records in a tab on detail screen

    scott duke Novice

      I was wondering if anyone has a good solution for trying trying to display thousands of records on a tab within a detail screen?


      I am using Richfaces.


      Within the Seam in Action book and examples they use a detail screen with tabs on the bottom portion of the screen. On these tabs are listings. These listings are great for small amounts of data. Unfortunately, for large amounts of data, the server gets bogged down and an error appears, because it wants to display everything.


      By going along with the examples in the book, the home class uses:



      public class InFilesHome extends EntityHome<InFiles> {
      
      ...
      
              public List<InCityStateZip> getInCityStateZips() {
                      if (getInstance() == null) {
                              return null;
                      }
                      List<InCityStateZip> inCityStateZips = new ArrayList<InCityStateZip>(
                                      getInstance().getInCityStateZips());
                      Collections.sort(inCityStateZips, new Comparator<InCityStateZip>() {
                              public int compare(InCityStateZip a, InCityStateZip b) {                                                                
                                      return (a.getStatus() == null || b.getStatus() == null) ? 0 : a
                                                      .getStatus().compareTo(b.getStatus());
                              }
                      });
                      return inCityStateZips;
              }
      
      ..
      
      }
      



      Using the tag rich:dataTable does not have an option to display a certain number of rows, but it caused an error.


      Using the tag rich:scrolableDataTable does have the option of displaying a certain number of rows, but it too caused an error.


      When I changed my rich:dataTable to refer to the InCityStateZipList.java rather than the getInCityStateZips() within the InFilesHome.java, the listing displayed, though it took several seconds. Slower than the listing screen itself. Also, switching between tabs is very slow.


      My question is this:


      What is the best way to retrieve/display the detail data on a tab within a detail screen and not have performance issues on retrieving the data or tabbing?


      Thanks,
      Scott

        • 1. Re: Displaying thousands of records in a tab on detail screen
          Damian Harvey Apprentice

          Use the rich:dataScroller. If you are setting the rows attribute on the datatable then you will get an error if it is absent.


          I find it useful to put it in the footer eg.


          ...
                  </rich:column>
                  <f:facet name="footer">
                          <rich:datascroller />
                  </f:facet>
           </rich:dataTable>
          


          Cheers,


          Damian.

          • 2. Re: Displaying thousands of records in a tab on detail screen
            Dan Allen Master

            Yeah, the child tables are really there if you have more reasonably sized data sets. For instance, if you were displaying a company, you wouldn't be able to just dump all the employees in the child table (unless it was a startup). In the golf course examples, things like the number of courses and the number of holes on the course is always fixed or within reason.


            It would be helpful if you mentioned what the error was (like a transaction timeout or a RichFaces parsing error).


            You are likely going to need to implement pagination which either reduces what is displayed or perhaps paginates the result set coming out of the database (like EntityQuery does).

            • 3. Re: Displaying thousands of records in a tab on detail screen
              scott duke Novice

              Thanks Damian. Your answer does allow the table to display without the error I was receiving. I was also able to do this another way using the list class. The error I was receiving was due to all of the data trying to be displayed at once. I have about 41,000 records.


              Dan, what you say makes sense.


              However, with such large amounts of data, it is still taking about 15 seconds just to display 10 records on the screen. Even when I use the listing class: InCityStateZipList.java it takes about 15 seconds to display. It shouldn't take more than 2 to 3 seconds, which is how long it takes when I query manually.


              • 4. Re: Displaying thousands of records in a tab on detail screen
                scott duke Novice

                I just tried the dataScroller as Damian suggested and I received this error:



                16:42:38,116 ERROR [ExceptionFilter] handling uncaught exception
                javax.servlet.ServletException: Servlet execution threw an exception
                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313)
                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                        at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:73)
                        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                        at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                        at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                        at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
                        at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
                        at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
                        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
                        at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                        at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                        at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                        at java.lang.Thread.run(Unknown Source)
                Caused by: java.lang.NoSuchMethodError: org.richfaces.event.DataScrollerEvent.<init>(Ljavax/faces/component/UIComponent;Ljava/lang/String;Ljava/lang/String;I)V
                        at org.richfaces.renderkit.html.DataScrollerRenderer.doDecode(DataScrollerRenderer.java:60)
                        at org.ajax4jsf.renderkit.RendererBase.decode(RendererBase.java:76)
                        at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:764)
                        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1006)
                        at org.ajax4jsf.component.AjaxViewRoot$1.invokeContextCallback(AjaxViewRoot.java:388)
                        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:672)
                        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:650)
                        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:681)
                        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:650)
                        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:681)
                        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:650)
                        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:681)
                        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:650)
                        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:681)
                        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:650)
                        at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
                        at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:405)
                        at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:101)
                        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                        ... 38 more
                16:42:38,116 ERROR [ExceptionFilter] exception root cause
                



                I will look a little later to see if the DataScrolerEvent is in my version of Richfaces.

                • 5. Re: Displaying thousands of records in a tab on detail screen
                  scott duke Novice

                  Ok... I got it working.


                  Now, back to the problem relating to the speed. It takes between 15-20 seconds to load on a detail screen, where on the listing screen it only takes about 3 seconds.