Appendix A. FirstEJB Example

Description

In this exercise, we’ll model an extremely simple business process: addition. The core logic is the same as one would write in a CS100-level undergraduate class, and we’ll create real EJBs from these small classes using a few annotations. In addition, this example shows how we may expose our EJBs through a variety of “views”: as business interfaces, as EJB 2.x legacy components, and as the new EJB 3.1 no-interface view.

The tests for this section come in both unit and integration flavors. The unit tests simply instantiate our classes as POJO objects and invoke their business methods directly, while the integration tests use a real backing container to make EJBs and invoke upon their proxy references. This shows the versatility of the EJB POJO programming model.

Get Enterprise JavaBeans 3.1, 6th Edition 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.