我尝试使用 ResultSet 创建 Jasper Print 以构建带有打印的 PDF 报告。问题是,Jasper Print 的创建速度非常慢。ResultSet 是一个包含大约 5000 行的表。创建打印需要超过 2 分钟。
我发现了这个解决方案:JasperReports fillReport too slow and resource sumption
但这对我不起作用。不同的是,我使用动态报告。
JasperPrint jasperPrint = DynamicJasperHelper.generateJasperPrint(dynamicReport, new ClassicLayoutManager(), resultSet);
编辑:关键部分在 JRVerticalFiller 类的 fillReport 方法中。
if (this.next()) {
this.fillReportStart();
while(this.next()) {
this.fillReportContent();
}
this.fillReportEnd();
}
fillReportContent 方法被一次又一次地调用了将近两分钟。