Designing a CMP Entity Bean

Figure 11.2 shows the design of the Order component. The OrderEJB container-managed entity bean implements the javax.ejb.EntityBean interface. It implements the methods setEntityContext(), unsetEntityContext(), ejbActivate(), ejbPassivate(), ejbLoad(), ejbStore(), and ejbRemove() as defined in the javax.ejb.EntityBean interface. It also implements the ejbCreate() and ejbPostCreate() methods.

Figure 11.2. Order entity bean design.

An OrderEJB entity bean class consists of the persistent fields orderId, studentId, orderDate, status, and amount. You do not code them as instance variables in the entity bean class. Instead, ...

Get Sams Teach Yourself EJB in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.