EJB Class Data Source

  • Last update:August 07, 2026
  • 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.

    1.png

    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

    iconNote: 
    You need to set up an EJB environment for providing the EJB data source before proceeding with the following steps.

    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.

    iconNote: 
    During remote design, the class file corresponding to the class dataset must be placed in both the local designer project and the remote server project.

    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.

    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy