add history of Hibernate

This commit is contained in:
Gavin 2023-05-07 12:09:21 +02:00 committed by Christian Beikov
parent d5e40c97dd
commit ce20e68c72
2 changed files with 42 additions and 6 deletions

View File

@ -7,16 +7,26 @@ include::Preface.adoc[]
:numbered: :numbered:
[[overview]] [[introduction]]
== Overview == Introduction
Hibernate is a library that makes it easy to map Java classes to relational database tables. Hibernate is usually described as a library that makes it easy to map Java classes to relational database tables.
Hibernate was the inspiration behind the _Java_ (now _Jakarta_) _Persistence API_, or JPA, and includes a complete implementation of the latest revision of this specification. But this formulation does no justice to the central role played by the relational data itself.
So a better description might be:
_Object/relational mapping_ takes the pain out 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. > Hibernate makes *relational data* visible to a program written in Java, in a *natural* and *typesafe* form,
>
> 1. making it easy to write complex queries and work with their results, and
> 2. allowing the program to easily synchronize changes made in memory with the database, respecting the ACID properties of transactions.
Here the relational data is the focus, along with the importance of typesafety.
The goal of _Object/relational mapping_ (ORM) is to eliminate fragile and untypesafe code, and make large programs easier to maintain in the long run.
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.
Even better, ORM makes it much easier to tune performance later, after the basic persistence logic has already been written. Even better, ORM makes it much easier to tune performance later, after the basic persistence logic has already been written.
[TIP] [TIP]
.ORM or SQL?
==== ====
A perennial question is: should I use ORM, or plain SQL? A perennial question is: should I use ORM, or plain SQL?
The answer is usually: _use both_. The answer is usually: _use both_.
@ -26,6 +36,26 @@ But if Hibernate is making things more difficult, for some particularly tricky p
Just because you're using Hibernate for persistence doesn't mean you have to use it for _everything_. Just because you're using Hibernate for persistence doesn't mean you have to use it for _everything_.
==== ====
[[hibernate-and-jpa]]
=== Hibernate and JPA
Hibernate was the inspiration behind the _Java_ (now _Jakarta_) _Persistence API_, or JPA, and includes a complete implementation of the latest revision of this specification.
[NOTE]
.The early history of Hibernate and JPA
====
The Hibernate project began in 2001, when Gavin King's frustration with Entity Beans in EJB 2 boiled over.
It quickly overtook other open source and commercial contenders to become the most popular persistence solution for Java, and the book _Hibernate in Action_, written with Christian Bauer, was an influential best-seller.
In 2004, Gavin and Christian joined a tiny startup called JBoss, and other early Hibernate contributors soon followed: Max Rydahl Andersen, Emmanuel Bernard, Steve Ebersole, and Sanne Grinovero.
Soon after, Gavin joined the EJB 3 expert group and convinced the group to deprecate Entity Beans in favor of a persistence model based on Hibernate.
Later, members of the TopLink team got involved, and the Java Persistence API evolved as a collaboration between—primarily—Sun, JBoss, Oracle, and Sybase, under the leadership of Linda Demichiel.
Over the intervening two decades, _many_ other talented people have contributed to the development of Hibernate.
Special credit must go to Steve, who has led the project for many years, since Gavin stepped back to focus in other work.
====
We can think of the library in terms of three basic elements: We can think of the library in terms of three basic elements:
- an implementation of the JPA-defined APIs, most importantly, of the interfaces `EntityManagerFactory` and `EntityManager`, and of the JPA-defined O/R mapping annotations, - an implementation of the JPA-defined APIs, most importantly, of the interfaces `EntityManagerFactory` and `EntityManager`, and of the JPA-defined O/R mapping annotations,
@ -40,9 +70,15 @@ As an application developer, you must decide whether to:
Whichever path you take, you will use the JPA-defined mapping annotations most of the time, and the Hibernate-defined annotations for more advanced mapping problems. Whichever path you take, you will use the JPA-defined mapping annotations most of the time, and the Hibernate-defined annotations for more advanced mapping problems.
[TIP] [TIP]
.Developing with "pure" JPA
====
You might wonder if it's possible to develop an application using _only_ JPA-defined APIs, and, indeed, that's possible in principle. You might wonder if it's possible to develop an application using _only_ JPA-defined APIs, and, indeed, that's possible in principle.
JPA is a great baseline that really nails the basics of the object/relational mapping problem. JPA is a great baseline that really nails the basics of the object/relational mapping problem.
But without the native APIs, and extended mapping annotations, you miss out on much of the power of Hibernate. But without the native APIs, and extended mapping annotations, you miss out on much of the power of Hibernate.
====
[[overview]]
=== Overview
This introduction will guide you through the basic tasks involved in developing a program that uses Hibernate for persistence: This introduction will guide you through the basic tasks involved in developing a program that uses Hibernate for persistence:

View File

@ -4,7 +4,7 @@
== Preface == Preface
Hibernate 6 is a major redesign of the world's most popular and feature-rich ORM solution. Hibernate 6 is a major redesign of the world's most popular and feature-rich ORM solution.
The redesign has touched almost every subsystem of Hibernate, including the APIs, mapping annotations, and query language. The redesign has touched almost every subsystem of Hibernate, including the APIs, mapping annotations, and the query language.
This new Hibernate is more powerful, more robust, and more typesafe. This new Hibernate is more powerful, more robust, and more typesafe.
Unfortunately, the changes in Hibernate 6 have obsoleted much of the information about Hibernate that's available in books, in blog posts, and on stackoverflow. Unfortunately, the changes in Hibernate 6 have obsoleted much of the information about Hibernate that's available in books, in blog posts, and on stackoverflow.