One Often-Overlooked Feature of Relational Databases

by chromatic

Hibernate's Gavin King recently published A Defense of the RDBMS. He has several useful points about ORM and object databases and their as-yet lack of success. Perhaps the most salient point is in the conclusion, however.


2007-05-24 11:22:30
I generally agree with the author, save for one concern: "almost every ORM solution on earth has the capability to automagically forward-engineer a schema from an object model"

Most "automagically generated schemas" I have seen initially work fine for the original consumer, but become problematic as soon as their data becomes valuable enough to be targeted by other applications (reporting/analytics are common here). By modeling the schema from a set of objects, instead of defining the data independently and logically, some unpleasant messes can be created.

Dick Davies
2007-05-24 23:02:00
"why are you using a relational database in that case?"

Because it's a readily available, well-understood, networked, transactional storage system. Why make another one?

2007-05-25 10:26:29
Well, in the relatively recent past, you had a choice between persistence with an RDBMS manager such as MySQL (with the added overhead of a separate server), or rolling your own persistence mechanism by extending BDB and related mechanisms like python shelve. The middle ground between these two has been lacking in tools.

Where things like db4o, prevlayer, and elephant (for common-lisp) have an advantage are cases that require something more complex than BDB key/value mappings, but a full RBDMS with client/server capabilities is overkill. That additional layering is useful when needed when not needed it just gets in the way. The bottom line of Mr. King's rant is that object databases fail for the kinds of multi-client, multi-application problem domains that MySQL and Oracle have pursued. Which is fine, but I don't think that every application that works with data needs to be multi-client and multi-application.

I think that Mr. King is either overstating the case for the "automagical ease" of ORM, or does not fully understand the limits of ORM. In my case, I needed bi-directional one-to-many relations, which the hibernate documentation admits is difficult, and apparently accounts for a large number of support requests. Using hibernate against HSQLDB, I repeatedly failed to get a working schema, even working through the copious documentation. Using db4o, I was able to do it using just ObjectContainer.set(object). I suspect that ORM works "automagically" for simple cases. More complex constraints might require some painful mapping indeed. (And this was working with a brand-new database.)

To be honest, I'm finding a lot of the rhetoric involved here to be depressing. No, object-oriented persistence mechanisms such as db4o are probably not going to challenge RBDMS for the multi-client, multi-process server space with data storage expected to exceed 20 years. On the other hand, RBDMS may not be the best choice for single-user solutions that juggle smaller datasets.

2007-05-25 12:37:31
Also, I find the 5,000 year archeologist argument to be amazingly silly. The archaeologist will have to figure out how to parse the tables used by Oracle or MySQL as much as the key/blob mappings used by object persistance mechanisms.

And in particular, MySQL, elephant, and shelve all can be configured to use Oracle Sleepycat, with complex objects stored as numbers and strings.

2007-05-30 09:01:36
On the other hand, RBDMS may not be the best choice for single-user solutions that juggle smaller datasets.

lookit SQLite

I use it in all sorts of stand-alone scripts, except for the most rudimentry.

2007-06-11 21:50:30
The relational database needs no defense
Christof Wittig, CEO of db4objects