JPA Introduction

This section introduces you with the Java Persistence API (JPA). We will learn the benefits of JPA specification.

JPA Introduction

JPA Introduction

     

This section introduces you with the Java Persistence API (JPA). We will learn the benefits of JPA specification. We will also list down the ORM frameworks that can be used with the JPA specification.

The Java Persistence API or JPA for short is Java Specification for persisting the Java Objects to relational database using popular ORM technology. JPA API provides enough tools to enable the java developers to create database driven applications quickly. The JPA API can be used to persist the business object (POJO) to the relational database. Retrieving the data from database in the form of business objects (Java Objects) is so simple with the help of JPA API.

What is JPA?

JPA is just an specification from Sun, which is released under JEE 5 specification. JPA standardized the ORM persistence technology for Java developers. JPA is not a product and can't be used as it is for persistence. It needs an ORM implementation to work and persist the Java Objects. ORM frameworks that can be used with JPA are Hibernate, Toplink, Open JPA etc.

These days most of the persistence vendors are releasing the JPA implementation of their persistence frameworks. So, developers can choose the best ORM implementation according to the application requirement. For example, production can be started from the free versions of ORM implementation and when the needs arise it can be switched to the commercial version of the ORM framework. You can switch the persistence provides without changing the code. So, ORM framework independence is another another big benefit of JPA.

Here are the benefits of JPA

  • Simplified Persistence technology
  • ORM frameworks independence: Any ORM framework can be used
  • Data can be saved in ORM way
  • Supported by industry leaders

ORM frameworks

Here are the list of ORM frameworks that can be used with JPA specification.

  • Hibernate
  • Toplink
  • iBatis
  • Open JPA

Why JPA?

  • JPA is standardized specification and part of EJB3 specification
  • Many free ORM frameworks are available with can be used to develop applications of any size
  • Application developed in JPA is portable across many servers and persistence products (ORM frameworks).
  • Can be used with both JEE and JSE applications
  • JSE 5 features such as annotations can be used
  • Both annotations and xml based configuration support

What is the current version of JPA Specification?

The current version of JPA specification is 1.0 at the time of writing of the tutorial. You can develop enterprise grade application using JPA 1.0. Future versions of JPA will provide many features.

In the next session we will learn the architecture of JPA specification.