JPA Specification


JavaEEJPARelevant topics

JPA Class Relationships

Classes and interfaces discussed above maintain a relationship. The following figure shows the relationship between classes and interfaces :

Spring Boot jpa

  • The relationship between EntityManager and EntiyTransaction is one-to-one. There is an EntityTransaction instance for each EntityManager operation
  • The relationship between EntityManageFactory and EntiyManager is one-to-many. It is a factory class to EntityManager instance
  • The relationship between EntityManager and Query is one-to-many. We can execute any number of queries by using an instance of EntityManager class
  • The relationship between EntityManager and Entity is one-to-many. An EntityManager instance can manage multiple Entities

JPA Implementations

JPA is an open-source API. There are various enterprise vendors such as Eclipse, RedHat, Oracle, etc., that provide new products by adding the JPA in them. There are some popular JPA implementations frameworks : Hibernate, EclipseLink, DataNucleus, etc. It is also known as Object Relational Mapping  (ORM) tool.

In Object-Relational Mapping the mapping of Java objects to database tables, and vice-versa, is called Object-Relational Mapping. The ORM mapping works as a bridge between a relational database (tables and records) and Java application (classes and objects).

In the following figure the ORM layer is an adapter layer. It adapts the language of object graphs to the language of SQL and relation tables :

Spring Boot jpa

The ORM layer exists between the application and the database. It converts the Java classes and objects so that they can be stored and managed in a relational database. By default, the name that persists becomes the name of the table and fields become columns. Once an application sets-up, each table row corresponds to an object.

JPA Versions

Earlier versions of EJB defined the persistence layer combined with the business logic layer using javax.ejb.EntityBean interface. EJB specification includes the definition of JPA.

While introducting EJB 3.0, the persistence layer was separated and specified as JPA 1.0 (Java Persistence API). The specifications of this API were released along with the specifications of Java EE 5 on May 11, 2006, using JSR 220.

In 2019 JPA was renamed to Jakarta Persistence. The latest version of JPA is 2.2. It supports the following features :

  • Java 8, data and time API
  • CDI Injection in AttributeConverters
  • It makes annotations @Repeatable

Previous Next

Leave a Reply

Your email address will not be published. Required fields are marked *