O'Reilly logo

Enterprise JavaBeans 3.1, 6th Edition by Bill Burke, Andrew Lee Rubinger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Source Listing

Following is a full listing of all source code used in this runnable example.

Implementation Resources

CalculatorBeanBase.java

package org.jboss.ejb3.examples.ch04.firstejb; import org.jboss.logging.Logger; /** * Base for bean implementation classes of the CalculatorEJB, * provides business logic for required contracts * * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a> */ public class CalculatorBeanBase implements CalculatorCommonBusiness { // ---------------------------------------------------------------------------|| ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required