Jump to content

Help needed using JRDataSource


junaed

Recommended Posts

Hello, I have been using jasper report for a while. Right now I am stuck using the JRDataSource.

I have created a report (attached). If i generate this using a direct connection to the database, it works perfectly. But if I try to generate it using a custom JRDataSource(attached), I get heap overflow error. The database query returns exactly one row. But I have found that when I am using the datasource, there are infinite calls to getFieldValue() for the same field.

I have attached necessary files here:

1. TestDataSource.java : my custom JRDataSource implementation.

2. PIRequest2.jrxml: the report.

Any help is highly appreciated. Thank you.

I am using the following code to generate the report:

Code:
String reportPath = "/report/PIRequest2.jrxml";            TestDataSource ds = getPIRequestReportDataset(this.pIRequestDetail.getIdNr());            System.out.println("got ds");            JasperDesign jasperDesign = JRXmlLoader.load(this.getClass().getResourceAsStream(reportPath));            System.out.println("jasper design created");            JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);//            JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportPath);            System.out.println("jasper report created");            Map parameters = new HashMap();            parameters.put("pi_request_id", this.pIRequestDetail.getIdNr().longValue());            System.out.println("creating jasper print...");            JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds);            System.out.println("before view..");            JasperViewer.viewReport(jasperPrint, false);
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...