A bit of history:
Entity beans were part of EJB 1 and 2. They were hell to work with, so there was an alternative. Then came the hibernate. (I do not remember these times)
Sleep mode evolved as a de facto standard in object-relational mapping. Then it was decided that a standard was needed, so the JPA specification was created that strongly influenced Hibernate.
JPA is just a specification - it defines what the ORM framework should do and what annotations it should support. JPA is implemented by many suppliers - Hibernate, EclipseLink, OpenJPA, etc.
So:
- do not use entity beans
- use any JPA implementation you like. Hibernate is definitely a good choice.
Update: About your secondary question in the comments:
Yes, you can use JPA with an beans beans session:
@Stateless public class YourSessionBean implements RemoteInterface { @PersistenceContext private EntityManager entityManager;
And you have an object manager introduced by the container and ready to work with JPA objects. Of course, you will need to create configurations for this, but this is beyond the scope of this question.
Bozho
source share