Implementing a Stateless Session Bean

Implementing a Session bean involves providing an implementation for the methods of the javax.ejb.SessionBean, corresponding methods for each method in the home interface, and a method for each method in the remote interface.

Implementing javax.ejb.SessionBean

The implementation of the methods of the SessionBean interface is often boilerplate. The setSessionContext() method usually just saves the supplied SessionContext object:

private SessionContext ctx;
public void setSessionContext(SessionContext ctx) {
    this.ctx = ctx;

Although ejbRemove() method is part of the SessionBean interface, you'll learn about its implementation in the next section. As already noted, for a stateless Session bean, the ejbActivate() ...

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

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