Overview
Application Scenario: This document describes how to retrieve data from an Enterprise JavaBeans (EJB) data source instead of directly accessing a database through a data connection.
Function Overview: FineReport retrieves data from an EJB data source by defining a class dataset that uses related EJB classes. FineReport then converts the retrieved data into a two-dimensional table that can be used as a report data source for display. The following figure shows a template created from an EJB data source.

Implementation Method
FineReport can use data from any type of data source because it reads data through the AbstractTableData abstract class. After you implement this abstract class, you can define a custom class dataset that the FineReport report engine can read and use as a report data source.
The AbstractTableData abstract class mainly provides five methods. For details, see Class Data Source.
In an EJB class dataset, the init() method retrieves data from the EJB data source and stores the returned data in an ArrayList.
Procedure
Note: Defining a Class Data Source
Before compiling DataModelDemo.java to a class file, add the FineReport JAR files and the EJB JAR files to the Java project. For details, see Compiling a Java Program.
Click to download the EJB JAR files: ejb.zip
Click to download the code for the DataModelDemo class: DataModelDemo.java.zip
Compiling a Class Data Source
Compile DataModelDemo.java to generate the DataModelDemo.class class file.
Copy the generated class file to FineReport installation directory/webapps/webroot/WEB-INF/classes\fr\data.
Note: Configuring a Class Dataset
Create a general report, add a class dataset in the dataset area, select the required class, and customize the dataset name, for example, Pro, as shown in the following figure.

Using the Class Dataset
After the class dataset is configured, drag data columns to cells to bind the data, as you do with other datasets, as shown in the following figure.

Save the template, start the application server where the EJB data source is deployed, and then preview the template in FineReport.