Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9038667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:32:35+00:00 2026-06-16T09:32:35+00:00

I have implemented LazyLoading for datatable. When I run through datatable by using pagination

  • 0

I have implemented LazyLoading for datatable. When I run through datatable by using pagination I am getting the following exceptions.

com.sun.faces.context.PartialViewContextImpl processPartial
INFO: java.lang.ArithmeticException: / by zero
java.lang.ArithmeticException: / by zero
    at org.primefaces.model.LazyDataModel.setRowIndex(LazyDataModel.java:62)
    at org.primefaces.component.api.UIData.setRowModel(UIData.java:411)
    at org.primefaces.component.api.UIData.setRowIndex(UIData.java:403)

ManagedBean

@PostConstruct
    public LazyDataModel<Request> getLazyModel() {
          if (lazyModel == null) {
           lazyModel = new LazyDataModel<Request>() {

            @Override
            public List<Request> load(int startingAt, int maxPerPage, String sortField,
                       SortOrder sortOrder, Map<String, String> filters) {
             return getRequestService().getRequest(startingAt, maxPerPage, sortField, sortOrder, filters);
            }
           };
           lazyModel.setRowCount(getRequestService().getRequestCount());           

          }
          return lazyModel;
         }

JSF

<h:form>
        <p:dataTable id="dataTable" var="req" lazy="true" value="#{reqMB.lazyModel}"
            paginator="true" rows="10"
            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
            rowsPerPageTemplate="5,10,15">

DAO for getting row count.

int count = ((Long)sessionFactory.getCurrentSession().createQuery
("select count(*) from Request").uniqueResult()).intValue();

Update 1

com.sun.faces.context.PartialViewContextImpl processPartial
INFO: java.lang.ArithmeticException: / by zero
java.lang.ArithmeticException: / by zero
    at org.primefaces.model.LazyDataModel.setRowIndex(LazyDataModel.java:62)
    at org.primefaces.component.api.UIData.setRowModel(UIData.java:411)
    at org.primefaces.component.api.UIData.setRowIndex(UIData.java:403)
    at org.primefaces.component.api.UIData.processChildren(UIData.java:291)
    at org.primefaces.component.api.UIData.processPhase(UIData.java:263)
    at org.primefaces.component.api.UIData.processDecodes(UIData.java:229)
    at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:506)
    at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
    at org.primefaces.component.api.UIData.visitTree(UIData.java:641)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601)
    at javax.faces.component.UIForm.visitTree(UIForm.java:344)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601)
    at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376)
    at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:252)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:32:36+00:00Added an answer on June 16, 2026 at 9:32 am

    According to comment #23 in the issue tracker of primefaces the following should fix that problem

    @Override
    public void setRowIndex(int rowIndex) {
        /*
         * The following is in ancestor (LazyDataModel):
         * this.rowIndex = rowIndex == -1 ? rowIndex : (rowIndex % pageSize);
         */
        if (rowIndex == -1 || getPageSize() == 0) {
            super.setRowIndex(-1);
        }
        else
            super.setRowIndex(rowIndex % getPageSize());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented clean URLs using the following in my .htaccess RewriteEngine on RewriteCond
I have implemented FBFriendPickerDelegate in my .h file and using the following delegate to
I have implemented pagination to my data, but the problem is I only have
I have implemented a test method with Jersey to run on my Google AppEngine
I have implemented a very basic sign up using email address+name, although I would
I have been using the ncommon framework ( http://code.google.com/p/ncommon/ ) with nhibernate and asp.net
I have implemented lazy loading in my program. it's done through a proxy class
I have successfully implemented lazy loading using the class UIImageView+WebCache.h . Is there any
I have implemented web service using rails server. The server uses rails default authentication
I am trying to implement lazyloading for Primefaces datatable. I have a filter condition

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.