Home Struts Training Day1 Introduction to the Java Persistence API
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Introduction to the Java Persistence API

Advertisement
In this section, we are going to discuss about the Java Persistence API (JPA). It is a part of Java EE5 (Java Enterprise Edition 5) and EJB 3.0 (Enterprise Java Beans 3.0) specification.

Introduction to the Java Persistence API

     

In this section, we are going to discuss about the Java Persistence API (JPA). It is a part of Java EE5 (Java Enterprise Edition 5) and EJB 3.0 (Enterprise Java Beans 3.0) specification. Java Persistence API provides simple POJO (Plain Old Java Object) class and standard OR mapping (Object Relational mapping). 

[POJO : It stands for Plain Old Java Object that is used for referring the Java objects. This is a very simple class that contains all normal java objects. It doesn't extend or implement specialized classes.]

To use JPA you must be configured the JPA behavior of your entities using annotations. The JPA behavior is managed by the JPA persistence The JPA provides the facility to Java developers for managing an object relational data in Java applications called an object/relational mapping. The most important feature of JPA is that it is an independent API and easily integrate with J2EE as well as J2SE applications.

The JPA also provides the facility to load and save the data into database table without using any SQL query. As like if you use the the persist() method then it executes the insert SQL and merge() method updates your records by update query. 

The javax.persistence:  This is the package that contains all classes, interfaces and annotations that makes up the JPA. 

Java Persistence can be used the following areas:

  1. To persist the Java object into database
  2. To query database
  3. To update the Java object into database
There are following JPA programming models:
  1. EntityManager API : It consists persist, update, retrieve, or remove objects from a database table.
  2. EntityManager API and object-relational mapping meta-data handles the database operations without writing JDBC or SQL query.
  3. JPA also provides the query language, for handling EJB querying language (known as JPQL). To retrieve objects without using SQL queries.

       

Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 17, 2009

Ask Questions?    Discuss: Introduction to the Java Persistence API  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com