Developing a Hibernate ODA extension
To develop the Hibernate ODA extension, create two new projects in the Eclipse PDE. These two projects implement the following plug-ins:
*org.eclipse.birt.report.data.oda.hibernate
The Hibernate ODA driver accesses a relational data source using HQL. The Hibernate ODA data source plug-in extends the functionality defined by the org.eclipse.datatools.connectivity.oda.dataSource extension point.
*org.eclipse.birt.report.data.oda.hibernate.ui
The Hibernate ODA user interface plug-in for BIRT Report Designer selects a Hibernate data source and creates an HQL statement to retrieve data from the available tables and columns. The Hibernate ODA user interface plug-in extends the functionality defined by the org.eclipse.datatools.connectivity
.oda.design.ui.dataSource, org.eclipse.ui.propertyPages, and org.eclipse.datatools.connectivity.connectionProfile extension points.
The user interface consists of the following pages:
*Data source page
Includes the Hibernate data source in the list of available data sources. The Hibernate ODA driver contains the preconfigured Hibernate configuration and mapping files that connect to the MySQL version of the BIRT demonstration database, Classic Models, Inc.
*Data set page
Creates an HQL statement that selects the data set and embeds the HQL statement in the report design.
In BIRT Report Designer, the Hibernate ODA data source wizard supports selecting a Hibernate ODA driver containing preconfigured Hibernate configuration and mapping files. The Hibernate ODA driver searches for these configuration and mapping files in the plug-in’s hibfiles directory.
The Hibernate ODA driver also searches in the hibfiles directory for JAR and ZIP files and the org.eclipse.birt.report.data.oda.jdbc plug-in for JDBC drivers to add to the classpath. This approach prevents the need to copy drivers to multiple locations. Note that changing the configuration causes the Hibernate ODA driver plug-in to rebuild the Hibernate SessionFactory, which is a machine-intensive operation.
Once the Hibernate ODA driver creates the data source configuration, a data set can be created. The Hibernate data set wizard allows the user to enter HQL statements. The Hibernate ODA user interface example supports only simple queries, such as the following types of statements:
From Customer
or:
Select ord.orderNumber,cus.customerNumber, cus.customerName
from Orders as ord, Customer as cus
where ord.customerNumber = cus.customerNumber and
cus.customerNumber = 363
The Hibernate ODA plug-in contains an exampleconfig directory. This directory contains a sample Hibernate configuration file, mapping files, and Java classes that connect to the BIRT sample MySQL database. Test the plug‑in using these files as follows:
*Modify the hibernate.cfg.file to connect to your database configuration.
*Copy these files to the hibfiles directory.
*Create a JAR file containing the Java classes.
You can test and deploy the extensions in the Eclipse PDE run-time environment.
The following sections describe how to create and deploy the Hibernate
ODA driver and user interface plug-in projects. To download the source code
for the Hibernate ODA driver and user interface extension examples, go to
http://www.actuate.com/birt/contributions.