Data Dictionary

The data dictionary maps Java persistent objects onto the corresponding RDBMS tables.   Originally this was done through information held in the RDBMS itself.  From version 1.10 the preferred method is to create an .XML format file.

XML Format Data Dictionary

RDBMS Data Dictionary

A class is mapped onto a single instance of an RDBMS table.  The data dictionary comprises 3 tables held in the primary database.

Data_Dictionary table

class_name (PK)

 table_name

 database_name

String

String

String

Database table

database (PK) 

Driver

url

username

passwd

connections

vendor

String 

String 

String 

String 

String 

integer 

String 

Class_Dictionary table

table_name (PK)

class_attribute 

table_column 

is_primary

String 

String 

String 

char

Data Dictionary bootstrap

The data dictionary is stored in relational database tables accessible using JDBC. These may be part of the main database or on an entirely separate database or RDBMS. In order to initialise the data dictionary a bootstrap properties file must be defined, this is called connection.properties and contains the following variables:-

driver=JDBC driver name
url=JDBC URL of database
username=Database username
password=Database password
data_dictionary=table where main data dictionary is stored
database_table=table name where database information is stored

An example would be:-

driver=postgresql.Driver|
url=jdbc:postgresql://sun2.kimble.co.uk:5432/orderdb
username=zardoz
password=wizard
data_dictionary=Data_Dictionary
database_table=Databases

Priming the data dictionary

The databases table must be primed with entries for the database containing the data dictionary and for any additional databases. The data dictionary is held in a database called primary, this is shared with the applications tables.

INSERT INTO databases VALUES (‘primary’, ‘ postgresql.Driver’, ‘jdbc:postgresql://sun2.kimble.co.uk:5432/orderdb’, ‘ zardoz’, ‘wizard’, -1, ‘postgres-3.2’);

Entries for each persistent object must now be added, for example a Customer table:

INSERT INTO data_dictionary VALUES (‘uk.co.kimble.examples.Customer’, ‘primary’, ‘customer’);
INSERT INTO class_dictionary VALUES (‘customer’, ‘ customer_id’, ‘customer_id’, ‘y’);
INSERT INTO class_dictionary VALUES (‘customer’, ‘name’, ‘ name’,‘n’);

etc…

This states that the customer table is mapped to a Java class called uk.co.kimble.example.Customer, the customer_id attribute is the primary key.  For brevity lines can be omitted where the attribute is not a primary key its name is the same as the database column name.  In the future it is intended to add two utilities to the COBRA utility suite. A graphic application for visually realizing data schemas and generating data dictionaries and an application to generate a data dictionary for legacy databases.