• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate vs JPA?

 
Jochen Szostek
Ranch Hand
Posts: 42
Android Google Web Toolkit Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Can someone please explain to me what the main differences are between JPA and Hibernate? (except for JPA being part of Java EE itself)

I have a feeling that JPA is a more basic version Hibernate, so please correct me if I'm wrong.

And does it make sense to use the JPA in Hibernate itself?

Thanks in advance for the possible replies!
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JPA is really a specification. It does nothing without an implementation.

It's like architectural drawings for a house. I mean, you can't live in a house until someone builds one. Drawings are great, but you can't live in them.

Hibernate provides an implementation of the JPA specification. Vendors providing EJB3.0 containers will also be providing an implementation of the JPA spec, so that means Sun and IBM WebSphere and Oracle and all the other handsome players in the industry will provide an implementation. Those are the houses you can live in.

Hibernate is awesome, and it was awesome before the JPA spec came out, and it is even more awesome since it has been providing an implementaion of the JPA spec.

-Cameron McKenzie
 
Jochen Szostek
Ranch Hand
Posts: 42
Android Google Web Toolkit Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Cameron Wallace McKenzie:
JPA is really a specification. It does nothing without an implementation.

It's like architectural drawings for a house. I mean, you can't live in a house until someone builds one. Drawings are great, but you can't live in them.

Hibernate provides an implementation of the JPA specification. Vendors providing EJB3.0 containers will also be providing an implementation of the JPA spec, so that means Sun and IBM WebSphere and Oracle and all the other handsome players in the industry will provide an implementation. Those are the houses you can live in.

Hibernate is awesome, and it was awesome before the JPA spec came out, and it is even more awesome since it has been providing an implementaion of the JPA spec.

-Cameron McKenzie


Aha! Thanks a lot!

So if I get it right, it can be compared somehow to an interface, allowing you to easily switch between different implementations in a project?

Thanks and greets,

Jochen
 
Cristian Vrabie
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it's true. The JPA is an API, a standardization effort from the java community. Hibernate authors heavily contributed at the creation of JPA. Hibernate is certified compliant with the Java Persistence API (with some limitations). However I prefer using plain Hibernate even if I don't respect the compliance mainly because Hibernate is in a continuous development and always benefits from the cutting edge technologies. It's better than waiting a few years for a java community meeting that will incorporate that in the specifications
[ July 09, 2008: Message edited by: Cristian Vrabie ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic