Using the EntityManager
The entity is used in conjunction with an
EntityManager to persist and otherwise ensure the state of the entity is consistent with the database. In this recipe we will examine the use of the
To use the entity in a client we need to:
- Inject the session facade EJB into the client
- Use the methods of the facade
We will build upon the
EntityBeanApplicationapplication developed in the first recipe.
How to do it...
Add a package called
servlet and a servlet called
PartsServlet to the WAR module. The
PartsBeanFacade class extends the
AbstractFacade class as developed in the Creating an entity facade recipe. It is associated with a persistence unit through the use of the @PersistenceContext annotation. ...