Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why has javax.persistence-api been replaced by jakarta.persistence-api in spring data jpa starter?

I've recently started to learn spring boot, data jpa. As I can see from this, the spring boot data jpa starter uses jakarta.persistence-api instead of javax.persistence-api:

   <artifactId>spring-boot-starter-data-jpa</artifactId>
   ...
   <dependencies>
      <dependency>
         <groupId>jakarta.persistence</groupId>
         <artifactId>jakarta.persistence-api</artifactId>
      </dependency>

      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <exclusions>
            <exclusion>
               <groupId>javax.persistence</groupId>
               <artifactId>javax.persistence-api</artifactId>
            </exclusion>
            ...
         </exclusions>
      </dependency>
   </dependencies>

What is the differences between jakarta.persistence-api and javax.persistence-api? What is the reason of this replacement?

like image 904
SternK Avatar asked Feb 01 '20 23:02

SternK


People also ask

What is Spring boot starter data JPA?

Spring Boot JPA is a Java specification for managing relational data in Java applications. It allows us to access and persist data between Java object/ class and relational database. JPA follows Object-Relation Mapping (ORM). It is a set of interfaces.

Is javax persistence same as Hibernate?

Hibernate is an implementation of the Java Persistence API, and where possible, you should use the standard annotations (in javax. persistence). This way, you could theoretically run your code on other JPA implementations. Only when you need Hibernate-specific functionality should you use the Hibernate annotations.

Which API is created with the help of persistence?

The Java™ Persistence API (JPA) provides a mechanism for managing persistence and object-relational mapping and functions since the EJB 3.0 specifications.

What is javax persistence used for?

Java Persistence is the API for the management for persistence and object/relational mapping. Used with the Access annotation to specify an access type to be applied to an entity class, mapped superclass, or embeddable class, or to a specific attribute of such a class. Represents an attribute node of an entity graph.


1 Answers

From Java Persistence API on Wikipedia:

The Java Persistence API (JPA), in 2019 renamed to Jakarta Persistence, is a Java application programming interface specification that describes the management of relational data in applications using Java Platform, Standard Edition and Java Platform, Enterprise Edition/Jakarta EE.

After Java EE was open sourced by Oracle and gave the rights to the Eclipse Foundation they were legally required to change the name from Java as Oracle has the rights over the Java brand. The name Jakarta was chosen by the community. You can find more information by reading The road to Jakarta EE and Jakarta EE - No Turning Back.

like image 126
Krisz Avatar answered Oct 09 '22 21:10

Krisz