• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA and Hiberate

 
C Shinde
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JPA and Hibernate are ORM solutions? what is the difference between them?
JPA can use Hibernate or any other ORM to work with DB but it also has its own implementation to work with the DB right?
Does JPA provide an common API to talk to any ORM that will work with a DB?

Can someone tell me more on this?

Regards,
Chetan Shinde
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C Shinde wrote:JPA and Hibernate are ORM solutions? what is the difference between them?

JPA is a standardized specification for ORM, while Hibernate being an ORM framework itself and also provides an implementation of JPA.
JPA can use Hibernate or any other ORM to work with DB

Yes If those ORMs implement JPA.
.. but it also has its own implementation to work with the DB right?

Hibernate does.
Does JPA provide an common API to talk to any ORM that will work with a DB?

It's the ORM framework should implement JPA hence can use any provider if that implements JPA
 
C Shinde
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you say that JPA is the common API whose implementation is provided by Hibernate,iBatis,Toplink and similar ORM? I have read a couple of places and thats what I understood.

I have read Hibernate books and have never read about JPA in their books....any idea why?

Thanks in advance.
 
C Shinde
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also where in the JPA configuration do I tell which ORM should I use?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C Shinde wrote:So you say that JPA is the common API whose implementation is provided by Hibernate,iBatis,Toplink and similar ORM? I have read a couple of places and thats what I understood.

I have read Hibernate books and have never read about JPA in their books....any idea why?

Thanks in advance.


iBatis is not JPA standard and in fact iBatis is not an ORM framework.
 
C Shinde
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I had a look at the persistent.xml file and there is a provider tag in that file which tells which provider is to be used....

Something like this...

 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C Shinde wrote:.. I have read Hibernate books and have never read about JPA in their books....any idea why?

Hibernate came before the JPA. So the books written before may not have JPA covered.
 
C Shinde
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you mean Hibernate has rewritten their API to JPA spec?

Chetan
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C Shinde wrote:So you mean Hibernate has rewritten their API to JPA spec?

No. Hibernate provide JPA through EntityManager implementation.
 
Devaka Cooray
Marshal
Pie
Posts: 4897
409
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the Hibernate EntityManager Library as well. Personally I would prefer using the EntityManager with JPA annotations on Hibernate, instead of using the session-based codes of old day hibernate.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic