File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate Or JPA Implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Or JPA Implementation" Watch "Hibernate Or JPA Implementation" New topic
Author

Hibernate Or JPA Implementation

milind moghe
Greenhorn

Joined: Aug 27, 2013
Posts: 4
Since I am a newbie I dont know where should I look for this information and I see this would be a very common question and somewhere it mush have been answered. We are planning to use persistent layer and we are evaluating the options. We found that Hibernate is very popular tool and has lot of rich features. Now we have option of using JPA implementation or use pure hibernate implementation(use entityManager or SessionManager ). I am confused right now which one to go for. What makes pure hibernate better than JPA impl? Or whats not there in JPA impl that will force us to use Hibernate? Do you have any pointers for it?
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2448
    
  28

If you use Hibernate as the JPA provider, you can really use both. For us, we picked JPA because we wanted to stick with "standard" java. So, we used Hibernate as the JPA provider, and implmented the code using JPA. However, we ran into some thing that Hibernate supports but JPA doesn't. Luckily, we just mixed in the Hibernate annotations with the JPA acnnotations, and Hibernate is fine with it. When the day comes we have to move away from Hibernate, 10% of the code won;t compile, and we will have to do something about it. Meh. atleast we went from 100% provider dependency to 10% provider dependency.
milind moghe
Greenhorn

Joined: Aug 27, 2013
Posts: 4
Thanks Jayesh for the prompt reply.

Is there a list of important hibernate features that are not part of JPA specification?

I also found that one can still access hibernate specific functionality by accessing session manager from entityManager. Has any one used this? and is that something we can use without any issues?

I also found an interesting article where

http://www.theserverside.com/news/2240186700/The-JPA-20-EntityManager-vs-the-Hibernate-Session-Which-one-to-use

In this article Emmanuel Bernard, a data architect for JBoss who is part of the Hibernate team has suggested to use entityManager over sessionManager. Something that forced me think more about JPA.


Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2448
    
  28

I don't have a list of features off hand. You might want to compare the javadocs for JPA annotations with javadocs for Hibernate annotations. There are lot of similarities, and in many cases JPA has even borrowed the name of the annotation from Hibernate. You will also find some differrences.
Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 255

Hey Milind,

I do not have complete list but I know that DetachedCriteria is one of such features as are available in Hibernate, but does not exist in JPA.


Regards
Salil Verma
milind moghe
Greenhorn

Joined: Aug 27, 2013
Posts: 4
Thanks Salil,Jayesh for your feedback. We are going with JPA but would use proprietary extension where ever it is required.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate Or JPA Implementation