May Java developers ask a question about JPA that "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 to this question is that JPA is not a new persistence technology rather it is build on the best ideas from existing persistence technologies like TopLink, Hibernate and JDO Java Data Object. In the result, JPA is a standardized specification that helps to build a persistence layer in java applications that is independent of any particular persistence provider.
JPA provides Java developers with an object / relational mapping facility for managing relational data in their Java desktop applications and Java EE web applications. JPA, Java Persistence consists of four areas which are mentioned below
- The Java Persistence API
- The query language
- The Java Persistence Criteria API
- Object / relational mapping metadata
- Java Persistence query language (JPQL): It is a simple and string based language just like SQL used to query entities and their relationships.
- Criteria API: It is used to create type safe queries using Java programming language APIs to query entities and their relationships from database.
For more information about JPA, JPA Coding, JPA Best Practice, how to use JPA in Java web applications development, see the below slides