I'm using Jasper Reports 6.7.0
but reports generating so slowly.
I'm generating report for only one record from the database but don't know why I'm getting poor performance.
I've referred some questions from stack overflow but isn't helpful
JasperReports fillReport too slow and resource consuming
I'm using following code on button click to generate report in JavaFX application.
@FXML
private void viewReport(ActionEvent e) {
Followup followup = followupTable.getSelectionModel().getSelectedItem();
if (followup != null) {
int fuRprtId = followup.getFuId();
try {
FileInputStream fis = new FileInputStream("src/com/homeo/reports/report1.jrxml");
BufferedInputStream bis = new BufferedInputStream(fis);
Map map = new HashMap();
map.put("fuId", fuRprtId);
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/OPD", "root", "");
JasperReport jasperReport = (JasperReport) JasperCompileManager.compileReport(bis);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, map, con);
JasperViewer.viewReport(jasperPrint, false);
} catch (SQLException | ClassNotFoundException | FileNotFoundException | JRException ex) {
Logger.getLogger(FollowUpController.class
.getName()).log(Level.SEVERE, null, ex);
}
}
SQL syntax:
SELECT
followup.`full name` AS followup_full_name,
followup.`complaints` AS followup_complaints,
followup.`remedy` AS followup_remedy,
followup.`fu id` AS followup_fu_id,
followup.`patientid` AS followup_patientid,
followup.`date` AS followup_date,
patient.`age` AS patient_age,
patient.`address` AS patient_address,
patient.`ref by` AS patient_ref_by,
patient.`occupation` AS patient_occupation,
patient.`diagnosis` AS patient_diagnosis,
patient.`mother` AS patient_mother,
patient.`matgrandmother` AS patient_matgrandmother,
patient.`mat grandfather` AS patient_mat_grandfather,
patient.`mat uncle` AS patient_mat_uncle,
patient.`mat aunt` AS patient_mat_aunt,
patient.`pat uncle` AS patient_pat_uncle,
patient.`pat aunt` AS patient_pat_aunt,
patient.`patgrand mother` AS patient_patgrand_mother,
patient.`pat grandfather` AS patient_pat_grandfather,
patient.`husband` AS patient_husband,
patient.`wife` AS patient_wife,
patient.`children` AS patient_children,
patient.`brother` AS patient_brother,
patient.`sister` AS patient_sister,
patient.`phone` AS patient_phone,
patient.`gender` AS patient_gender,
patient.`dob` AS patient_dob,
patient.`patnt id` AS patient_patnt_id,
patient.`father` AS patient_father
FROM
`patient` patient INNER JOIN `followup` followup ON patient.`patnt id` = followup.`patientid` where `fu id` = $P{fuId}
It is taking approx 8 seconds to load
How to speed up it?
Also report don't load when I build an app