This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes JPA and Hiberate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA and Hiberate" Watch "JPA and Hiberate" New topic
Author

JPA and Hiberate

C Shinde
Ranch Hand

Joined: Oct 22, 2009
Posts: 60
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

Regards,
Chetan Shinde
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

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


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
C Shinde
Ranch Hand

Joined: Oct 22, 2009
Posts: 60
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

Joined: Oct 22, 2009
Posts: 60
Also where in the JPA configuration do I tell which ORM should I use?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9353
    
    2

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.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
C Shinde
Ranch Hand

Joined: Oct 22, 2009
Posts: 60
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

Joined: Mar 24, 2008
Posts: 3827

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

Joined: Oct 22, 2009
Posts: 60
So you mean Hibernate has rewritten their API to JPA spec?

Chetan
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

C Shinde wrote:So you mean Hibernate has rewritten their API to JPA spec?

No. Hibernate provide JPA through EntityManager implementation.
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3060
    
  38

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.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA and Hiberate