Create the data model (Java) - POJO using JAXB

The data model identifies where the data comes from.

What is a data model?

A data model is the hierarchy of memory classes that represent the data for the report application. A data model consist of one or more classes. These memory classes are called POJO (plain old java objects). The data model is serialized (converted to XML) to be sent to the Genero Report Engine.

Creating a data model

There are two approaches to creating a data model.
  1. You can generate the data model using the Business Application Modeler. It creates the classes and populates the classes using SQL. In addition, the data schema is created.
  2. You can write the data model by hand. When you manually create a data model, you are responsible for the code that creates and populates the classes.

The data model in Genero Report Writer

Within Genero Studio for Genero Report Writer, you can have up to three different representations of a data model:
  1. For generated applications, the Business Application Modeler creates a Data Model Diagram (.4rdj), a graphical representation of the data model. It is composed of one or more business records, which in turn represent the SQL queries that fetches the data.
  2. The Data Schema (.xsd) file is an XML schema file. It gives a tree view of the data model, written in XML.
  3. A set of classes is provided in the application source.

Feeding the data

If the data model is generated, the requisite SQL to feed the data model will have been created.

If the data model is handwritten, the code for feeding the data must also be handwritten, as discussed in the following topics:

For an example of feeding the report data from a plain old java object (POJO) using JAXB, examine OrderReportJava.java in the OrderReportJava demo application. Search for the method runFromJAXBObject. The class objects are created to hold the data, and the data is brought in one row at a time using an iterator. When the program moves to the next row, the previous row is released from memory.

Note: Ensure that the JAXB environment set is selected.