Wednesday, May 9, 2012

why JPA?




Why JPA?

A fundamental question for many Java developers is "Why JPA?
 Why do I need to know how to use this API when object-relational mapping tools like Hibernate and Toplink are already available?"

The answer is that JPA is not a new technology; rather, it has collected the best ideas from existing persistence technologies like Hibernate, TopLink, and JDO.

The result is a standardized specification that helps you build a persistence layer that is independent of any particular persistence provider.

http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html





The Java Persistence API - A Simpler Programming Model for Entity Persistence

A major enhancement in EJB technology is the addition of the new Java Persistence API, which simplifies the entity persistence model and adds capabilities that were not in EJB 2.1 technology.

The Java Persistence API deals with the way relational data is mapped to Java objects ("persistent entities"), the way that these objects are stored in a relational database so that they can be accessed at a later time, and the continued existence of an entity's state even after the application that uses it ends.

In addition to simplifying the entity persistence model, the Java Persistence API standardizes object-relational mapping


The Java Persistence API draws on ideas from leading persistence frameworks and APIs such as Hibernate, Oracle TopLink, and Java Data Objects (JDO), and well as on the  earlier EJB container-managed persistence


The Java Persistence API simplifies the programming model for entity persistence and adds capabilities that were not in EJB 2.1.

Here's a quick list of its simplifications and additions:

Provides cleaner, easier, standardized object-relational mapping
Eliminates the need for lookup code
Adds support for inheritance, polymorphism, and polymorphic queries.
Provides a Java Persistence query language -- an enhanced EJB QL


http://www.oracle.com/technetwork/articles/javaee/jpa-137156.html