Skip to content

Commit e203f47

Browse files
committed
add a note about "leaky abstractions"
1 parent c15e5b1 commit e203f47

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ But if Hibernate is making things more difficult, for some particularly tricky p
3434
Just because you're using Hibernate for persistence doesn't mean you have to use it for _everything_.
3535
====
3636

37+
Let's underline the important point here: the goal of ORM is _not_ to hide SQL or the relational model.
38+
After all, Hibernate's query language is link:{doc-query-language-url}[nothing more than an object-oriented dialect of ANSI SQL].
39+
40+
.Is Hibernate a "leaky abstraction"?
41+
****
42+
Hibernate--and ORM in general--has been accused of being a _leaky abstraction_, that is, of failing to completely hide the underlying relational database.
43+
Is this true?
44+
Well, as you can guess from what we've already said, the short answer is: yes, _and that's a good thing._
45+
Of course, whether you consider an abstraction "leaky" depends on what you think it's trying to abstract.
46+
Hibernate successfully abstracts many things: variations between dialects of SQL, messy interactions with JDBC, SQL object naming conventions, and so on.
47+
But it doesn't even attempt to pretend there's anything other than a relational data model underlying all this.
48+
The simple reason is performance. It's just not possible to <<tuning-and-performance,achieve acceptable performance>> in data access without acknowledging the nature of the underlying persistent representation.
49+
We're old enough to have seen multiple generations of developer relearn this lesson by experience.
50+
****
51+
3752
Developers often ask about the relationship between Hibernate and JPA, so let's take a short detour into some history.
3853

3954
[[hibernate-and-jpa]]

0 commit comments

Comments
 (0)