Jasper Reports 6.14 filling and generating report is so slow

0

I'm using

  • JDK 11.0.8+10
  • Hibernate 5.4
  • NetBeans 11.0
  • Java FX      
  • on Debian 10.5

               

DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance();
                JRPropertiesUtil.getInstance(context).setProperty("net.sf.jasperreports.xpath.executer.factory",
                        "net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory");
 
                BLManager bLManager = new BLManager();
                List beanCollection = bLManager.searchReportId(118);
                try ( InputStream inputStream = JavaFXApplication.class.getResourceAsStream("/javafxapplication/Quotation.jasper")) {
                    JRBeanCollectionDataSource jRBeanCollectionDataSource = new JRBeanCollectionDataSource(beanCollection, false);
                    JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, null, jRBeanCollectionDataSource);
                    JasperViewer.viewReport(context, jasperPrint, false);
                    JasperViewer.viewReport(jasperPrint, false);
 
                } catch (JRException | IOException ex) {
                    Logger.getLogger(JavaFXApplication.class.getName()).log(Level.SEVERE, null, ex);
                }

This code take to fill report approx 20 seconds after event fired.

But once it is filled then for second time it doesn't take even 1 second to fill up report again.

I've tried including and excluding Jaxen Path but thing not gonna change.

I'm using JPA CriteriaQuery to retrieve record as follows :

public List searchReportId(int id) {
  try ( Session session = sessionFactory.openSession()) {
        CriteriaBuilder criteriaBuilder = session.getCriteriaBuilder();
        CriteriaQuery<Client> criteriaQuery = criteriaBuilder.createQuery(Client.class);
        Root root = criteriaQuery.from(Client.class);
        criteriaQuery.where(criteriaBuilder.equal(root.get("id"), id));
        return session.createQuery(criteriaQuery).getResultList();
      }  
} 

So what would be reason taking such long time to filling reports?

How can I improve speed of filling report?

swapnilnagtilak722's picture
Joined: Apr 6 2019 - 7:59am
Last seen: 3 weeks 5 days ago

0 Answers:

No answers yet
Feedback
randomness