EJB
If you ever created an EJB application using older versions of JEE specifications, J2EE, you would remember that data persistence was achieved using Entity Beans, which implemented the javax.ejb.EntityBean
interface, and you had to implement all those horrifying methods and provide different implementations, depending on the persistence nature of the entity bean, that is container-managed or bean-managed.
Thanks, mostly, to Hibernate, the Java Persistence API (JPA) was born to simplify the implementation. In the next section, we will see how to set up Hibernate as the entity manager when using EJB 3.
Persistence unit
In the JPA world, the Entity Manager represents the persistence unit. It is defined by the javax.persistence.EntityManager
interface. This is the JPA API that is your gateway to the persistence store, just as the Hibernate Session is when working directly through the Hibernate API. In EJB3, you will need to declare the persistence unit and let the application server know who...