As a specification, Jakarta Persistence API (formerly Java Persistence API) deals with perseverance, which freely means any mechanism by which Java objects outlive the application process that created them. Not all Java objects need to be saved, but most applications save key business objects. The JPA specification allows you to define which objects must be preserved and how they are saved in your Java applications.

JPA itself is not a tool or a framework; rather, it defines a set of concepts that guide implementers. While the JPA model for object-relational mapping (ORM) was originally based on Hibernation, has since evolved. Similarly, while JPA was originally intended for use with relational databases, some implementations of JPA have been extended to use with NoSQL data warehouses. A popular framework that supports JPA with NoSQL is EclipseLinkthe reference implementation for JPA 3.

The main idea behind JPA, unlike JDBC, is that for the most part JPA allows you to avoid the need to “think relationally.” In JPA, you define your rules for consistency in Java code and objects, while JDBC requires from you for manual translation of code in relational tables and vice versa.

Popular JPA implementations such as Hibernate and EclipseLink now support JPA 3. Migrating from JPA 2 to JPA 3 involves some changes in the namespacebut otherwise the changes are improvements in productivity under the hood.

JPA and Hibernate

Due to their intertwined history, Hibernate and JPA are often confused. However, similar to the Java Servlet specification, JPA has created many compatible tools and frameworks. Hibernate is just one of the many tools of JPA.

Developed by Gavin King and first released in early 2002. Hibernation is an ORM library for Java. King developed Hibernate as an alternative to entity beans for permanence. The framework was so popular and so necessary at the time that many of its ideas were adopted and codified in the first JPA specification.

Previous articleGitHub adds math support to Markdown
Next articleTop 25 Excel Formulas You Should Know [Updated]