What is JPA

http://www.cnblogs.com/yy3b2007com/p/6838982.html

What is JPA

Java Persistence API: API for Object Persistence

The ORM specification of the Java EE 5.0 platform standard enables applications to access the persistence layer in a uniform manner.

The relationship between JPA and Hibernate

  JPA is an abstraction of Hibernate (just like the relationship between JDBC and JDBC drivers):

1) JPA is a specification: JPA is essentially an ORM specification, not an ORM framework ------ because JPA does not provide an ORM implementation, it only formulates some specifications and provides some programming API interfaces, but the specific implementation The implementation is provided by the ORM vendor.

2) Hibernate is the implementation: In addition to being an ORM framework, Hibernate is also a JPA implementation.

  Functionally, JPA is a subset of Hibernate functionality.

 Supplier of JPA

  One of the purposes of JPA is to develop an API that can be implemented by many vendors. Currently, Hibernate3.2+, TopLink10.1+ and OpenJPA all provide JPA implementations.

  Hibernate

1) The initiator of JAP is the author of Hibernate;

2) Hibernate is compatible with JAP since 3.2.

  OpenJPA

OpenJPA is an open source project provided by the Apache organization

  TopLink

TopLink used to charge, but now it's open source.

Advantages of JPA

standardization

  Providing the same API ensures that enterprise applications developed based on JPA can run under different JPA frameworks with a few modifications.

Simple and easy to integrate

  One of the main goals of JPA is to provide a simpler programming model. Creating an entity under the JPA framework is as easy as creating a Java class, and only needs to be annotated with javax.persistence.Entity; the JPA framework and interface are very simple.

Comparable to JDBC query capabilities

  JPA's query language is object-oriented. JPA defines unique JPQL and other advanced query features that only SQL can usually provide, and even supports subqueries.

Support for advanced object-oriented features

  JPA can support advanced object-oriented features, such as integration between classes, polymorphism and complex relationships between classes, to maximize the use of object-oriented models.

JPA includes 3 technologies

ORM mapping metadata

  JPA supports two forms of metadata, XML and JDK5.0 annotations. The metadata describes the mapping relationship between objects and tables, and the framework persists entity objects to database tables accordingly.

JPA API

  Used to manipulate entity objects, perform CRUD operations, the framework does everything in the background, and developers are freed from cumbersome JDBC and SQL code.

Query Statement (JPQL)

  This is a very important aspect of persistence operations, querying data through object-oriented rather than database-oriented query languages, avoiding tight coupling between programs and specific SQL.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326489683&siteId=291194637