* Posts by Jim A

1 post • joined 30 Apr 2008

Backlash starts against 'sexy' databases

Jim A

Object DB for complex data

I think the power and popularity of RDBMS is due primarily to the standard query language and efficient indexing which makes those queries fast. If your application does not use those heavily and you want to 'model' your data using complex objects, you might want to consider something else, like an Object database.

For example, we have a very complex Contact object that needs to be simply saved by ID and re-read later; I considered pasting the entire serialized object graph here but it is 1300+ lines and goes 5-6 levels deep (for a single object); here are a few of the hundreds of XPath's to give you some idea of the types of data involved:





There are also addresses; co-borrowers; assets; etc etc etc.

Here is all the code needed to save this ENTIRE object to db4o (and the code to read it is similar); NO O/R problems here:

String fileName = "TEST.db4o";

ObjectContainer db = Db4o.openFile( fileName );

try {

db.set(contactObject); // That's it ! Your entire object graph is saved.


'Normalizing' this object would take a LONG time; and a LOT of code; and make it more difficult to make future changes.

There are also commercial object DB's (Objectify, Intersystems Cache) that provide SQL access to your objects; too bad no open-source projects do a decent job of this (yet?).



Biting the hand that feeds IT © 1998–2017