Comparison
Object-relational impedance mismatchvsObject-relational mapping
Object-relational impedance mismatch
inheritance, collections and object identity all had to become foreign keys, and none of the three translations were free.
The structural gap between an object model — identity, references, inheritance, encapsulation — and a relational one — keys, joins, tables, no behaviour. It is why mapping inheritance requires a choice of three imperfect strategies, why a collection becomes a join table, and why object identity and primary keys are not the same thing. Naming it is what stops a team believing there is a mapping tool somewhere that does not have these problems.
Full entry →Object-relational mapping
you wrote no SQL, and then spent an afternoon reading the SQL it generated to find out why the page was slow.
A library that maps rows to objects and generates the queries in between, usually implementing data mapper or active record plus an identity map and unit of work. It removes an enormous amount of mechanical code and gives back a layer whose performance characteristics are invisible until they are a problem. Every serious user of one ends up learning to read the generated SQL, which is the fair summary of the trade.
Full entry →