what is similarity and difference between jpa and hibernate.
This is the introduction of the JSR-000220 Enterprise JavaBeans 3.0 Final Release (persistence):
This document is the specification of the Java API for the management of persistence and object/rela- tional mapping with Java EE and Java SE. The technical objective of this work is to provide an object/relational mapping facility for the Java application developer using a Java domain model to man- age a relational database.
This persistence API—together with the query language and object/relational mapping metadata defined in this document—is required to be supported under Enterprise JavaBeans 3.0. It is also targeted at being used stand-alone with Java SE.
Leading experts throughout the entire Java community have come together to build this Java persistence standard. This work incorporates contributions from the Hibernate, TopLink, and JDO communities, as well as from the EJB community.
In other words, JPA is the standardized API for persistence. Hibernate provides an implementation of the standard (i.e. it can be used as underlying persistence engine when using JPA).
Prior to JPA, Hibernate was a kind of de facto standard for object persistence in Java. Hibernate is considered as a major contributor to JPA so there are lots of similarities between them (I could even say between all ORM solutions as ORM concepts are common). However, for various reasons, political or technical, the JPA working group couldn't include everything in the first release of JPA so JPA is actually a subset of Hibernate (this is a simplified view but the reality is very close). Hibernate and other JPA implementation provide thus their own proprietary extensions (which means non standards i.e. not portable from one provider to the other) to the JPA standard that you may use, or not.