JPA Overview

JPA stands for Java Persistence API. It is an ORM (Object Relation Mapping) tool. It is a layer between Java Application and database. JPA is a specification, not an implementation.


API (classes and interfaces) of JPA are stored in javax.persistence package.

The JPA 1.0 was released in 11 May 2006.
The JPA 2.0 was released in 10 December 2009.
The JPA 2.1 is released in 22 April 2013.

The implementations of JPA are given as below...
  • Hibernate
  • Eclipselink
  • Toplink
  • OpenJPA
  • iBatis etc.

Advantages of JPA:
1. We can switch between ORM tools (Ex. Hibernate, toplink, eclipselink etc.)
2. Fast development (No need to create tables manually, It creates tables automatically)
3. We need to think only on Java's class relation not on the relation of tables.
4. No need to convert data from bean object to Statement object for insertion.
5. No need to convert data from ResultSet to bean object for fetching.
6. No need to create SQL query.
7. We can switch from one database to other database easily

Disadvantages of JPA:
1. Additional overhead between Java Application and database.
2. Time complexity more than JDBC (If we will not use Cache)