JavaBean DataSource doesn't get passed to the sub-sub-report

0

Hi there,

i'm having trouble finding out how to correctly pass a JavaBean DS to a subsubreport. I have the following Java code:

         
         JRDataSource javaBeansKapitelDS = new JRBeanCollectionDataSource(BeanFactory.generateKapitelCollection());
         jasperReport = JasperCompileManager.compileReport("JRXML/Subreports.jrxml");
         jasperUnterkapitelReport = JasperCompileManager.compileReport("JRXML/Subreports_subreport1.jrxml");
         jasperEntryReport = JasperCompileManager.compileReport("JRXML/Subreports_subreport1_subreport1.jrxml");
 
         params.put("SUB_DATASOURCE", BeanFactory.generateUnterKapitelCollection());
         params.put("SUB_SUB_DATASOURCE", BeanFactory.generateEntryCollection());
         
         jasperPrint = JasperFillManager.fillReport(jasperReport, params, javaBeansKapitelDS);
         JasperExportManager.exportReportToPdfFile(jasperPrint, "output/TestJAVABeansDS.pdf");
 
 
In the main report i have a report, which has a subreport, which in turn has its own subreport. In the main report i set the Datasource of the subreport as DataSource Expression "new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{SUB_DATASOURCE})" and works just fine!
 
In the subreport i tried doing the same thing for the subsubreport (new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{SUB_SUB_DATASOURCE})) but i can't pass the SUB_SUB_DATASOURCE parameter from the main report to the subreport in order to use it there. If i define in the main report a parameter for the subreport:
<subreportParameter name="SUB_SUB_DATASOURCE">
     <subreportParameterExpression><![CDATA[$P{SUB_SUB_DATASOURCE}]]></subreportParameterExpression>
</subreportParameter>

i get an exception 

Caused by: java.lang.NoSuchMethodException: Unknown property '' on class 'class jasperreports.datasource.Entry'

...

Fill 1: exception
net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean :
... 
 
I'm using the latest jasper reports library -5.5.1
 
So my question is: how do i pass to the subreport the JavaBeansDS in order to use it there for the subsubreport?
 
Thanks a lot for your time!
Alex
alexandru.tigaeru's picture
Joined: May 20 2014 - 1:47am
Last seen: 5 years 4 months ago

0 Answers:

No answers yet
Feedback
randomness