Skip to content

Commit 48d74cf

Browse files
committed
add a new definition of what ORM is all about
1 parent e0feff4 commit 48d74cf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

documentation/src/main/asciidoc/introduction/Introduction.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ The goal of _object/relational mapping_ (ORM) is to eliminate fragile and untype
2323
ORM takes the pain out of persistence by relieving the developer of the need to hand-write tedious, repetitive, and fragile code for flattening graphs of objects to database tables and rebuilding graphs of objects from flat SQL query result sets.
2424
Even better, ORM makes it much easier to tune performance later, after the basic persistence logic has already been written.
2525

26+
Actually, the problem that object/relational mapping solves has been mischaracterized for decades, and has very little to do with any so-called "mismatch" between classes and tables. The real problem is:
27+
28+
1. Data is stored in **normalized tables**.
29+
2. The process of efficiently reading data from tables **<<join-fetch,denormalizes the data with joins>>**.
30+
3. In an object-oriented program, we often want to work with data in something quite close to its **original normalized form**.
31+
32+
Therefore, the principal task of object/relational mapping is to _renormalize the data after reading it from the database_. This need exists even if the classes in our program are identical to the database tables.
33+
2634
[TIP]
2735
// .ORM or SQL?
2836
====

0 commit comments

Comments
 (0)