0

I am trying to generate a PDF using a JRXML file while passing values in jasperParameter and then fetching it in JRXML. The issue is explained below:

List<Integer> values = myService.methodName();

This returns a size greater than 1000. I further go ahead to print a PDF for which I use a JasperReports. I store values inside a bean named MyBean and pass it to generate a PDF.

generator.generatePDF(response, myBean);

My PDF generation code looks as follows:

Connection connection = setUpDataSource();
HashMap<String, Object> jasperParameter = setUpJasperParameter(pdfBean);
ByteArrayOutputStream reportOutputStream = export2PdfStream(jasperFilePath, connection, jasperParameter);

Here in setUpJasperParameter method we put those list of Integer values greater than 1000 inside jasperParameter hashmap.

Later on, when i go to print my Jasper Report using

JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(jasperFilePath, jasperParameter, conn);

This is actually caused because of my demo.jrxml which has queryString inside which I am fetching multiple rows from a view. SELECT ROW A, ROW B , ROW C,...ROW Z FROM MYVIEW WHERE $X{IN, valuesToDisplay ,values}

In above query, it gives me an error saying Ora 01795 maximum number of expressions in a list is 1000.

Is there any work around in which this can be handled on the Java end or on the JRXML where the List<Integer> values can be handled if the size is approximately around 4500?

Alex K
  • 22,315
  • 19
  • 108
  • 236
Ankit
  • 1
  • `Is there any work around in which this can be handled on the java end or on the JRXML where the List values can be handled if the size is approximately around 4500` - Sure, this is your Java code - you can create and pass several parameters with lists – Alex K Jul 03 '20 at 05:52
  • The size of `values` list is dynamic and keeps changing. Sometimes it can be 1000z sometimes 4000, how can we handled this in java, using subList? But how many new parameters are we going to keep passing? No idea about it. – Ankit Jul 03 '20 at 07:00

0 Answers0