Handling very large reports

Sometimes, when filling a report, the report datasource may have a lot of data. In some cases, the generated report can become very large, and in some cases larger than the memory allocated for the JVM, causing an OutOfMemoryException.

It is possible to set up JasperReports so that it stores segments of a report on the disk in order to free some memory. This can be accomplished by using a built-in report parameter REPORT_VIRTUALIZER. The value for this parameter must be an instance of a class implementing net.sf.jasperreports.engine.JRVirtualizer. JasperReports comes with an implementation of this interface, namely net.sf.jasperreports.engine.fill.JRFileVirtualizer. This implementation is sufficient to handle the vast ...

Get JasperReports 3.5 for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.