Hi I am new to Persistence. I want to use ORM in my project and i want to use JPA. As i am new, i am bit confused whether to use EJB3 entity beans or hibernate. I know both follow JPA. Can i use ejb3 entity beans following jpa without any need of hibernate or i need to use hibernate too. Someone told me that if i am using entity beans 3 still i have to use EntityManager implementation of JPA provided by Hibernate. please help.
Vinod K Singh
Joined: Sep 30, 2008
Hibernate is an implementation of EJB3 persistence API. I would suggest to code to EJB3 API and use Hibernate as an underlying implementation.
JPA is a persistence API, and Hibernate is just one implementaion of that API. You should definitely use JPA, but you do not need to use Hibernate. The vendor implementation that you use is up to you, and will depend upon your preference. I usually recommend TopLink Essentials to people that are starting out since a) it is the Reference Implementation and ships with the Sun Glassfish server b) it is the easiest one to install and get going c) it was created by Oracle and I work for Oracle :-). It is just a couple of jar files and can be downloaded from the Glassfish site here.