Skip to content

Hibernate Mapping

bydga edited this page Feb 2, 2014 · 13 revisions

General info - master branch

Following info is valid since Jan 2014:

  • Database was migrated from oracle to postgres. Because of this, some POJO properties were removed (like ora_rowscan, oracle.Blob data types etc.). XML data types used in scenario schemas has been removed too - as they are not supported in postgres and its not intended to use them at all.
  • The database has been completely recreated by Hibernate (hbm2ddl.auto=create), some unnecessary SQL alter scripts were removed (and their meaning has been reflected in the new mapping - see below.
  • Whole portal now uses only @annotation mapping. All hbm.xml mapping files were deleted. Mapping now reflects actual DB structure.
  • All connection strings are now specified ONLY in project.properties. Thanks to this, hibernate.cfg.xml has been removed and hibernate configuration is simplified inside Spring's applicationContext.xml

* There exists a chance, that you might encounter some of remaining pieces of dead code ( ScenarioSchemaType DAOs, facades etc.). Feel free to clean it.

Usage of nosql database

  • details in Elasticsearch
  • Some experiment properties are being migrated to nosql database (Elasticsearch). New "GenericParameter" was introduced to encapsulate all (well, at least most) of the existing parameters.
  • Migrated properties:
  • Hardware, Software, Disease, Pharmaceutical, Weather, Temperaure, Digitization, ProjectType. * They are represented as GenericParameter with structure:
{ 
  "name": "hardware/software/etc...", 
  "valueString": "textual value if applicable for this parameter", 
  "valueInteger": 88      #(int value if applicable for this parameter), 
  "attributes":           #array of additional infos for this parameter
  [
    {
      "name": "some name",
      "value": "some value"
    }
  ] 
}

Where does it join together?

  • As you can see, some Experiment data are stored in relational database (through hibernate) and some of them are in Elasticsearch.

  • Pairing of these entities is accomplished in so-called Interceptor. During Experiment entity load process, it takes its hibernate id and fetches appropriate document form elasticsearch and merges them (id in elastic corresponds with the one in hibernate). During entity flush, it saves desired parameters into elastic. Pure Magic :).

  • Now this class also does synchronization of "old" relational parameters and new Generic style parameters. After the migration is completed, this sync code should be removed.

Clone this wiki locally