Could someone please explain to me what the main differences are between JPA and Hibernate?
Where to use Hibernate ?
Where to use JPA?
Why not entity bean?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A little history:
Entity beans were part of EJB 1 and 2. They were hell to work with, so an alternative was due. Then Hibernate appeared. (I don’t remember these times)
Hibernate evolved to be a de-facto standard in object-relational mapping. Then it was decided that a standard is needed, so the JPA specification was created, highly influenced by Hibernate.
JPA is just a specification – it defines what an ORM framework should do, and what annotations should it support. JPA is implemented by many vendors – Hibernate, EclipseLink, OpenJPA, etc.
So:
Update: About your secondary question in the comments:
Yes, you can use JPA with EJB Session beans:
And you have the entity manager injected by the container and ready to operate JPA entities. Of course you’d need to make configurations for that, but that’s out of the scope of this question.