views:

362

answers:

2

I need to design a report, that displays the data from a collection(Say List). This list contains multiple POJOs.

The POJOs are populated by the data access layer of the application. How do I design a report template for this requirement in iReports?

A: 

Use JRBeanCollectionDataSource for your report.

Bozho
Shouldn't I use JavaBean set datasource?
Vaishak Suresh
for a collection of beans, this is the one to use :)
Bozho
A: 

Ok! Found the answer. The steps are as below.

  1. Compile the bean classes and create a JAR file. This needs to have the complete package
  2. Add this jar to the LIB folder in ireports
  3. Create a factory/wrapper class that has a createBeanCollection method that populates a collection
  4. Use this class's top level package as the class path in ireports
  5. Use this class as the JavaBean datasource with the method.

Once all this is done, create a report with the new datasource and in report query, give the FQN on the Java bean and add the desired field.

Vaishak Suresh