views:

102

answers:

3

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.

+2  A: 

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...

musiKk
@musiKk thank you very much and Sorry I will be patient hereafter.
Code 'N' Weed
Granted it's easy to get spoiled by the fast response times here. ;)
musiKk
+3  A: 

As Pascal answered here

JPA is just an API. To use JPA, you need an implementation of this API and such implementations are called persistence providers (EcliseLink, Hibernate, OpenJPA)

Jaydeep
+2  A: 

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.

locka