Mike 2.8.2011

Working on the back-end database and java interface.  After going through a lot of documentation and partial examples, I figured out a way to dynamically map java HashMaps of key value pairs to a hibernate managed database.  I did it by using the dynamic mapping capability of Hibernate.  Hibernate simply requires an xml document to map keys to database columns.  I plan on creating a meta class structure that will either store object meta information or read it straight from the database tables and create the required xml documents as required.  If a new property is added to a dynamic object, the meta class will generate a new xml document for Hibernate and hibernate takes care of the SQL ALTER calls.

Reasons why this is good:

  • We can make use of dynamic Flex objects
  • Our object types can evolve and grow with time and be transferred between instances
  • We can connect to almost any database type (all types supported by hibernate) without rewriting anything
  • We can make use of libraries made to work with hibernate for things like lazy loading and data pagination
  • We don’t have to write sql queries for most things (if a Car has an Owner and we have a reference to the Car object, calling car.getOwner() will cause hibernate to do the database call for us)