In 2002, Martin Fowler first proposed the “Data Mapper” pattern in his famous book Enterprise Application Architecture Patterns, which maps object-oriented domain models to relational databases.

In 2003, Australian programmer Gavin King, a veteran of data systems, developed an object-relational mapping framework Hibernate because he disliked the complex architecture of EJB Entity Bean 1.1. Remarkably, he had never developed a system in SQL before. To develop Hibernate, he popped into a bookstore and bought a book on SQL basics. Now Hibernate has become the most popular object relational mapping (ORM) tool.

In 2006, the EJB 3.0 Software Expert Group released version 1.0 of the Java Persistence API (JPA) specification. Object – relational mapping (ORM) is normalized. JPA is not limited to EJB 3.0; you can use it in Web applications, or even desktop applications. It is now the standard for Java database persistence. Version 2.2 is currently available.

Hibernate implements JPA and is by far the most popular implementation of the JPA specification.

Spring Data JPA is a layer of encapsulation of JPA. It enables us to define the query interface only for the properties of persistent objects when defining JPA queries. Spring automatically provides the implementation, greatly simplifying jPA-based query operations.

For current JPA-based data access, the general approach is:

  • Based on theJPAPerform object-relational mapping.
  • Based on theSpring Data JPADefine queries for data access and access.
  • HibernateAs aJPAIn the background. None of the code is directly usedHibernate.

The rest of the book is based on this idea.

For details, please click here ↓↓↓

Original | using JPA implementation DDD persistence – JPA, Hibernate and Spring Data JPA

So that’s it, next we’ll talk about “JPA vs MyBatis”**.

If you feel there is a harvest, click a [praise] to encourage!