By bloid
via adam.blogs.bitscribe.net
Published: Jan 09 2007 / 11:40
Object-Relational Mappers (ORMs) have been a hot topic for, oh I don’t know, a decade now. Mapping an object-oriented data set onto a flat relational schema is unexpectedly difficult. But why go to so very much trouble to map the data from an OO format and back again? Why not just keep the objects in object format all the time?
Comments
hiveminds replied ago:
The main reason for OO databases not taking over is because data storage media is still magnetic disk sector based. As large electronic memory storage comes so will the use of objects in their native state.
dgary replied ago:
Well, a lack of a solid standardized querying language is kind of a point against odbms
jmcantrell replied ago:
anyone who has actually used a decent RDMS knows that most ORM is many orders of magnitude slower than using plain sql code, and when you get to the "relation" part of ORM, it's ends up being much more complicated and ugly than to just use sql. ORM is good for abstraction, but that's about it...
rbygrave replied ago:
My 2c got a bit big but here it is...
OODBMS vs RDBMS
- CJ Date & Type Inheritance
- Object Graph building/traversal
- Ad Hoc query support
- Inheritance & SQL3
- Updates in a Stateless environment
CJ Date & Type Inheritance::
----------------------------
There is a view by some (CJ Date included) that the only thing OO brings to
the Relational model is Type Inheritance. SQL3 includes Type Inheritance
but its not widely supported by RDBMS Vendors. I wonder if this is still
the case?
Object Graph building/traversal::
---------------------------------
OODBMS are generally designed to do this well (better than ORM/RDBMS).
ORM/RDBMS may be able to make some optimisations that make
this faster (closer to OODBMS) using Physical ROWID's and fetch ahead
(of related data) type strategies.
OODBMS may have a much smaller performance benefit when the database is
very large (and OODBMS behaves more like RDBMS/ORM).
http://www.avaje.org/rowid.html
Ad Hoc query support::
----------------------
RDBMS/SQL is very good at Ad Hoc queries. For me, the Relational approach
shines in this area (compared with both ORM or OODBMS).
Inheritance & SQL3::
--------------------
It could be said that complex inheritance hierarchies are better handled
by OODBMS as opposed to ORM/RDBMS. For me this is largely due to
RDBMS vendors not implementing all of SQL3 - specifically the
Table Inheritance part.
Postgres and Virtuoso perhaps are leading the way here.
http://www.avaje.org/typeinheritance.html
Updates in a Stateless environment::
------------------------------------
For stateless Web development it should be noted that a Relational SQL Update
has advantages over ORM (not sure about OODBMS). Specifically in avoiding
a fetch of the Object just to update(or delete) it and accidentally bypassing
Optimistic Concurrency Checking.
For me, this scenario is best handled by a simple SQL Update.
Check it out at...
http://www.avaje.org/ormupdate.html
Voters For This Link (12)
Voters Against This Link (0)