Skip to content.
CCB > iTools? > ITools_Database

NCBC iTools - Database Configuration

Summary

iTools? uses Hibernate to connect and interface with its database. Hibernate is an Industry-standard ORM (Object-Relation-Mapping).

Detailed DB Description

Hibernate

Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves Object-Relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions. Hibernate's primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types).

iTools does not use directly SQL, which has to be modified each time we switch to a new different database. iTools uses Xdoclet, a code-generation tool to dynamically create the mapping file (.hbm.xml). Check the iTools source java file and the created file .hbm.xml inside package edu.ucla.loni.ccb.itools.model in the src and classes directories. The mapping files are created from javadoc tags starting with _hibernate.*.

Hibernate/Xdoclet will be invoked automatically if the dao.type is hibernate. But iTools' Hibernate functionality can be tested by calling ant create-tables-sql, which will writes the SQL to a file named create-tables.sql, which could be used towards building a corresponding relational database. Notice the detail sql will be different if we specify a different database by modifying database.type variable in the build.properties file.

DB Tables

There are 4 iToosl DB Tables:
  • User - to store all user specific information
  • NcbcResource & AllProperties - to store NCBC resource
  • ResourceReviews - to store resource reviewes, user comments and resource rankings

Note that the NcbcResource table has only two columns. All of its content is saved in AllProperties, each Descriptor and its value is saved as one row. For instance, if an NcbcResource has a name of value Pipeline, in NcbcResource table it will have a row of (id, "CCB"). Here id is Primary Key, created automatically by Hibernate, CCB is the center of this resource. In the table of AllProperties, there is a row (id, "name" "Pipeline"). The main flexibility arising from this design is that when a new descriptor is later added to NCBC resource, that means the xml schema was modified to add one new element, the DB table needs not to be modified, the effect of this revision is just a new row added to the AllProperties table for each resource. On the contrary, if we had all resources listed and described in the same NcbcResource table, with one column for each of all its descriptor fields, then we would have to modify the DB table by adding a new column for this new description field.