My colleague just asked me this question and i thought its quite a common question in, lot of developers mind.
Well as you might aware of now we have a much leaner and easy to use Ejb 3 specifications.
The EJB 3.0 specififcation is divided into two parts the first which deals with session and MDBs and the second which deals with persistence and entity beans.
This later part is know as JPA.And as i say latter part so this is independent of session and other concepts.This means that this can be used outside of any Server or managed Container .You can use JPA in SDK just like you write “Hello World”,no need of any Server or container.
JPA works with normal java beans so your code can be just Java beans ,some XML/annotatons about how Object’s are mapped with tables and you are good to go,very easy to write test cases as well.
And hibernate 3.0 implements the JPA specification so TopLink and other O/R mapping framework.So your code depends upon JPA Api and its implementation is supplied by any JPA impl vendor framework.
So in effect if you use JPA , you are using a standard Java Api and not some orthogonal Api and hence you have flexibility in your system.
Say initially you have used Hibernate but now want to shift to Other framework.That means JPA supports pluggable persistence providers.
JPA specification is heavily influenced by current O/R mapping frameworks like Hibernate and Top-Link .
So if i need to put in Concise words:
a) JPA is Persistence Api which your code should use.
b) JPA Api will pass on the call to actual peristence provider (ex:Hibernate/TopLink) to do the actual work.
c) If you are looking from Performance prespective ,it will be dependent on actual peristence provider (Hibernate/TopLink) and not on JPA as its just a wrapper layer.
d) If you are looking from code dependency prespective ,JPA makes more sense as your code is dependent on standard Java Api.
e) If you have used Hibernate then you will find that certain features are missing in JPA like criteria queries etc.This does not mean that you can’t write criteria query in your application, you need to get Session object from JPA Entity manager and now you are as good as in hibernate project.
But now your code is dependent on Specific impl (Hibernate),going forward you can see more things getting added in JPA (2.0)
f) Should you use JPA: My take is you should ,API is clean and although not everthing you need is their but is a good step forward.
Hopefully this give better picture as where all these pieces fits into an Java based Enterprise Application .