This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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?
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.
Joined: Aug 27, 2013
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 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.