Spring JPA Implementation


Spring JPA Implementation

We must first obtain the essential dependencies before establishing a Spring Data JPA application.

The following components are required to construct a persistence layer that leverages Spring Data JPA:

  • The JDBC driver implements the JDBC API with a database-specific implementation. Because it makes our sample application easier to operate, we employ the H2 in-memory database.
  • Our application can connect to a database using the data source. The HikariCP data source is the quickest data source on the earth. Hence we use it.
  • The JPA provider implements the Java Persistence API. Because Hibernate is the most popular JPA provider, we use it.
  • The utilized JPA provider is hidden behind Spring Data JPA's repository abstraction.

Implementations of the JPA

JPA is a free and open-source application programming interface. Various enterprise vendors, such as Eclipse, RedHat, Oracle, and others, provide new products that include JPA. Hibernate, EclipseLink, DataNucleus, and others are popular JPA implementation frameworks. The Object-Relation Mapping (ORM) tool is another name for it.

Mapping of Objects and Relationships (ORM)

Object-Relational Mapping (ORM) maps Java objects to database tables and vice versa. The ORM mapping connects a relational database (tables and records) to a Java application (classes and objects).

Between the application and the database is the ORM layer. It turns Java classes and objects into relational database objects that may be stored and managed. By default, the persist name is used as the table's name, and fields are used as columns. Each table row corresponds to an item once the program is set up.