O'Reilly logo

Sams Teach Yourself J2EE™ in 21 Days by Peter Roxburgh, Andy Longshaw, Debbie Law, Dan Haywood, Martin Bond

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

Specifying a Stateless Session Bean

As you will by now have gathered, the responsibilities of Session beans (and indeed, Entity beans) are specified through its remote and home interfaces. These are what the EJB container makes available to the remote clients.

To define a home interface for a stateless Session bean, extend javax.ejb.EJBHome. To define a remote interface, extend javax.ejb.EJBObject. Because both EJBHome and EJBObject extend the java.rmi.Remote interface, the rules for remote objects (in the Java sense of the word) must be followed.

The following is the home interface for the Agency session bean. If it looks familiar, it should be—you saw this for the first time just yesterday.

 package agency; import java.rmi.*; import javax.ejb.*; ...

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