Pages

Sunday, August 26, 2012

Java Persistence API

What is persistence?

The general objective of persistence is to increase the life span of an object. This could be done by storing it in a disk, file etc... One simple method is to store the object in xml format. Another way of implementing the persistence is to use the databases.

Why do we need JPA?

If you consider about databases, usually it is used in the form of tables that are related in the traditional relational methods. How ever on the other hand objects are entities that has states and can invoke methods that makes it unique. So there is some conflict in objects way of keeping data and keeping data in databases.  JPA is introduced to fulfill this inadequacy.

Java Persistence

The Java Persistence Architecture API is a java specification for accessing, persisting, managing data between java objects, classes and databases. It is considered as the industry approach for object relational mapping (an ORM). That is it helps to retrieve data from the data in the form of java objects. This simplifies the life of a java developer significantly. 

However JPA  is a standard for the java persistence. Probably most of you must have heard about hibernate. Hibernate is a vendor implementation of the JPA and addition to that it provides some additional non JPA facilities as well.

No comments:

Post a Comment