Client Applications

Yesterday, you saw how a client application uses JNDI to obtain a reference to a Session bean home object and how to obtain a Session bean by calling the appropriate create() method. Now that you have a better understanding of how Session beans work, there are a few other points that are worth appreciating.

Design Considerations

First, if your client has a reference to a stateless Session bean, although it should call remove() when it is finished with the EJB, this method call doesn't actually do much. In particular, it won't release any bean resources itself. What this will do is allow the EJB container to remove the EJBObject proxy for the bean.

Conversely, calling create() for a stateless Session bean doesn't necessarily ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second 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.