JBoss.orgCommunity Documentation

Chapter 3. Hibernate ODA Data Source


The JBoss BIRT Integration feature includes the Hibernate ODA Data Source completely integrated with Hibernate Tools. You can use it in the way you use any of BIRT ODA drivers. Let's perform simple actions that demonstrate it.

First, run the Seam Generate Entities action (You can access it from File > New > Seam Generate Entities in the Seam perspective. More details on the Seam Generate Entities read in our Seam Dev Tools Reference guide). This action will create a Hibernate Console configuration.


Before performing Seam Generate Entities, you should have a connection profile adjusted and connected to a database. How to do this see in the CRUD Database Application chapter of the Seam Dev Tools Reference guide.

Next add a new BIRT report. To do that navigate to File > New > Other > Business Intelligence and Reporting Tools > Report. In the New Report wizard enter the report name, for instance testHibernateOda.rptdesign, then click Finish.

Creating a New BIRT Report

Figure 3.1. Creating a New BIRT Report

Now switch to the Report Design perspective.

In the Data Explorer View right-click the Data Source node and choose New Data Source.

Creating a New Data Source

Figure 3.2. Creating a New Data Source

In the wizard select Hibernate Data Source and give it a proper name, HbDataSource for instance. Hit Next.

Creating Hibernate Data Source

Figure 3.3. Creating Hibernate Data Source

On the next wizard page leave everything as it is, just press the Test Connection button to verify the connection is successful.

Hibernate Data Source Profile

Figure 3.4. Hibernate Data Source Profile

Click Ok and then Finish to complete.

Now let's add a Hibernate ODA dataset. To do that you should bring up the New Data Set wizard. In the Data Explorer View right-click the Data Set node and select New Data Set.

Creating a New Data Set

Figure 3.5. Creating a New Data Set

In the Data Set Name section specify the name. Let's it be HbDataSet.

Creating a Hibernate ODA Data Set

Figure 3.6. Creating a Hibernate ODA Data Set

Next you'll be prompted to define the query for this data set. To validate the entered query you can press the Test query button. All the HQL features like syntax highlighting, content assist, formatting, Drag and Drop, etc., are available to you here.

Testing Query

Figure 3.7. Testing Query

Next the output columns will be displayed. It's possible to edit them here.

HQL Features - Output Columns Section

Figure 3.8. HQL Features - Output Columns Section

To preview the results of the defined query click the Preview Results item.

HQL Features - Preview Results Section

Figure 3.9. HQL Features - Preview Results Section

So far you have the Hibernate data source and data set defined. Now you can create a BIRT report using this data source and data set.


If you don't know how to do this we suggest that you refer to the Eclipse BIRT Tutorial.

Creating a BIRT Report using Created Data Source and Data Set

Figure 3.10. Creating a BIRT Report using Created Data Source and Data Set

If you switch to the Preview tab, it will run your report and show the output.

BIRT Report -Preview Tab

Figure 3.11. BIRT Report -Preview Tab

You can also use parameters within the Hibernate ODA driver.

Using Parameters within the Hibernate ODA Driver

Figure 3.12. Using Parameters within the Hibernate ODA Driver

Adding New Parameter

Figure 3.13. Adding New Parameter

Again, to preview the results switch to the Preview Results item.

Previewing the Results

Figure 3.14. Previewing the Results