I learnt JPA for ORM. Now i am asked to use Hibernate as my provider. If i start with Hibernate it is going down in different concept. Please say me How can i relate JPA and hibernate together. JPA reduces my Java code into simple code for persisting Objects. Now what does hibernate help JPA and what does it provide. Anyone please explain in simple.
Hibernate is not another concept; it is just one of many JPA implementations. Another would be EclipseLink. If you and the implementations keep to the specification then switching the implementation is just a matter of changing a couple of lines in your persistence.xml
(e.g. the <provider>
tag and implementation specific properties). At least in theory...
JPA is an API specification for persisting objects. It defines a SQL like query language, and annotations for defining entities and relationships.
Hibernate is an implementation of JPA that has various extensions as well as a legacy API and query language. As long as you don't use any of the extensions of Hibernate and stick with the JPA API you can more or less treat it interchangeably with other JPA implementations such as OpenJPA, TopLink etc.