JPA- Java Persistence API

From the very beginning of software development and more so with web applications, the need for storing state and details of objects have been there. The most used manner to store information has been databases. And with storing data into database, need for a standardized way to store this data has been felt.

The most common way to persist data into database is JDBC, i.e. Java Database connectivity. JDBC is Java Specific implementation of ODBC (Open Database Connectivity). It allows simple way for Java to execute SQL commands and interact with Database. Though it is easy to use, JDBC has a major challenge of SQL portability across Database vendors. The SQL command which works fine for oracle might now work for mysql or ms-sql.

Another popular approach for data persistence is ORM or object relational mapping. The idea is to map Java objects (POJOs) directly to a table in database. There are many strong players like Toplink (now eclipse link) and hibernate in this space.

Then came another important player EJB- entity beans. With EJB 2.0, support for persistence was good, but at cost of implementing complex EJBs.

There is another specification for persistence, JDO, Java Data Objects, which is mostly used to save Objects directly and hence make a good case for non relational or no-sql database usage.

Because of all the above mentioned options available for persistence in Java, need for standards became very important, which resulted first in JPA 1.0 and later a more complete specification in form of JPA 2.0.