Specifying a Stateless Session bean

You already know that there are two different types of Session bean—stateful and stateless. You'll see examples of both types today, but the first example you will study is the stateless Agency bean you saw yesterday.

As you will by now have gathered, the responsibilities of Session beans (and indeed, Entity beans) are specified through their 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 you extend javax.ejb.EJBHome; and to define a remote interface you extend javax.ejb.EJBObject. Because both EJBHome and EJBObject extend the java.rmi.Remote interface, their methods are restricted as follows:

  • All methods ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.