You are on page 1of 19

Create Datamart

Angelo Bernabei
2011/02/10 10:41

spagobi_server - Create Datamart

Table of Contents
Create Datamart ......................................................................................................................................................................... 3
1 Reverse engineering the target database schema ................................................................................................................ 3
2 Hibernate mapping adjustement ........................................................................................................................................ 16
3 jar production for datamart representation ........................................................................................................................ 18

Page 2 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Create Datamart
The datamart is a data abstraction model built by means of Hibernate Tools. The main steps are:
1 Reverse engineering the target database schema
2 Hibernate mapping adjustement
3 jar production for datamart representation

1 Reverse engineering the target database schema


In order to reverse engineering your target database scheme you need an Eclpise IDE with Hibernate Tools plugin already
installed. Hibernate Tools can be downloaded here . Once you have installed succesfully the pluging in your Eclipse IDE
you can follow these steps in order to reverse engineering your database schema...
Start Eclipse and create a new Java Project

Page 3 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Page 4 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Create a new Hibernate Configuration file under src folder(File Menu -> New ->#Other then Hibernate -> Hibernate
configuration file)

Page 5 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Page 6 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Choose the right dialect for your database and fill all the required fields (driver class, connection string, schema,
username and password). Then check 'create console configuration' and press 'Next'.

Page 7 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Fill the console name field and in the 'option' tab set the db dialect

Page 8 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

In the 'classpath' include in the default classpath the proper jdbc driver for your target database than click 'Finish'

Page 9 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Select "Hibernate Code Generation Configuration..." from menu Run->Hibernate Code Generation ...

Page 10 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Create a new configuration for the code generation task

Page 11 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Set the name of the newly created configuration


Select as console configuration the hibernate configuration previusly created (demo in this example)
Select project's src dir as 'Output directory'
Set the package name of the generated code (it.foodmart in this example)
Set the field 'reveng.strategy' with the value: org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy

Page 12 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

If you want to reverse engineering only some tables and not the full schema create a new reveng.xml file. To filter
tables click on 'Refresh' button and then wait until the full database schema is shown. At this point is possible to
choose which table to include in the code generation process. Once finished click on 'Finish'

Page 13 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

In the 'Exporters' section check options as follow....

Page 14 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Click on the 'Apply' button to save configuration and on the 'Run' button to execut the code generation process
Refresh the project (F5) and check out the newly created mappings and objects

Page 15 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

2 Hibernate mapping adjustement


If you want to customize labels and tooltips associated to each item in your datamart structure you create a
label.properties file in the root of your java project

Page 16 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

TIPS: under SpagoBIQbeEngine web application you can find label.properties file, you can use this to create yours
custom file

If you need to localize labels and tooltips associated to each item in your datamart structure create a
label_loacle.properties for each locale you need to support (ex. label_it.properties, label_en.properties,
label_fr.properties, ecc ...)

Create in the project root folder a file named qbe.properties for changing the visual representation of schema items
(visibility, icons, position, ecc ...)

Page 17 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

3 jar production for datamart representation


Export the project as a jar file (menu File->Export...->Java->Jar) named datamart.jar

Page 18 - last modified by Angelo Bernabei on 2011/02/10 10:41

spagobi_server - Create Datamart

Page 19 - last modified by Angelo Bernabei on 2011/02/10 10:41