[Learning] Spring Data family understand Spring Data JPA, Jpa and Hibernate

Before starting Spring Data JPA, first of all discuss the relationship before the next Spring Data Jpa, JPA and Hibernate.

JPA

JPA is referred to as the Java Persistence API, the Chinese name of the Java Persistence API, is JDK 5.0 annotations or XML description of the object - mapping between relational tables, solid objects and run persistence to the database.

Sun introduced the new JPA ORM specification for two reasons: First, simplify the existing Java EE and Java SE application development work; Second, Sun hopes the integration of ORM technology, the world normalized.

JPA EJB 3.0 software developed by the expert group, as part of JSR-220 implementation. But it is not limited to EJB 3.0, Web application you can even use desktop application. JPA's mission is to provide persistent POJO standards, we can see, after several years of practice and exploration, can run independently from the container, facilitate the development and testing of the concept has gained a. Hibernate 3.2+, TopLink 10.1.3 and have provided OpenJPA implementation of JPA.

JPA's overall thinking and existing Hibernate, TopLink, JDO and other ORM frameworks broadly consistent. In general, JPA includes the following three aspects of the technology:

  • ORM mapping metadata: JPA supports two forms of metadata and the XML JDK 5.0 annotations, metadata that describes the relationship between the object and the mapping table, the frame whereby the entity object persisted to the database table
  • API: used to manipulate physical objects, perform CRUD operations, the framework in the background alternative we have completed everything, developers freed from the tedious JDBC and SQL code.
  • Query Language: This is the persistence of a very important operation in one aspect, rather than object-oriented database query language for query data, to avoid the tight coupling process SQL statements.

Hibernate

Hibernate object-relational mapping framework is an open source, to carry out a very lightweight JDBC object package so that Java programmers can use arbitrary object programming thinking to manipulate the database, and object has its own life cycle, with the focus on an object relationships between objects, have their own HQL query language, so the database is very portable. Hibernate ORM framework is complete, is in line with the JPA specification. Hibernate has its own caching mechanism. More difficult to get started from a point of view, more suitable for enterprise-class application development.

The relationship between JPA and Hibernate?

  • 1.JPA hibernate is an abstraction.

    JPA is a specification: the JPA ORM specification is a kind of nature, not ORM framework - as JPA ORM does not provide him realize just have some guidelines, the API provides a number of programming interfaces, but the specific realization by ORM vendor implementation.

    Hibernate is achieved: Hibernate as ORM framework in addition, it is also a JPA implementation.

  • 2. Functionally, JPA Hibernate is a subset of the functions.

Spring Data JPA

JPA specification can be understood as re-packaging abstract, bottom, or use of Hibernate JPA technology, cited JPQL (Java Persistence Query Language) query language, is part of the Spring entire ecosystem. With Spring Cloud Spring Boot and popular in the market, Spring Data JPA is gradually coming into our field of vision, they form an organic whole, more convenient to use, to speed up the efficiency of the development, so developers do not need more care and Configuration something completely immersed in the full realization of ecological standards of Spring. JPA started simple, high development efficiency, support for object the better, there are a lot of flexibility, market acceptance is increasing.

Relations Spring Data JPA and JPA?

Spring Data JPA is provided on the basis of the implementation of the JPA specification under Repository layer, but using an ORM which you need to decide for themselves; compared to the more familiar Hibernate and MyBatis, Spring Data JPA can be seen as a higher level of abstract. Spring persist in doing this piece of work, the development of Spring-data-xxx series of packages, such as: Spring Data JPA, Spring Data Redis, Spring Data Mongodb etc., which are based on JPA and Spring offers a number of other NOSQL the Repository.

Reference article:

Spring Data JPA books from entry to the master

https://spring.io/projects/spring-data

https://www.oschina.net/p/spring-data

https://www.ibm.com/developerworks/cn/opensource/os-cn-spring-jpa/

Published 38 original articles · won praise 67 · views 60000 +

Guess you like

Origin blog.csdn.net/havendream/article/details/104555415