15.7. Handles

A handle is a serializable object that uniquely identifies a particular remote object (EJB object or home object) on a server. Of course, this is true of the stub held by the client as well, but a stub is not guaranteed to be serializable. In practice, for reasons that will be discussed, stubs are serializable, which means that the use of handles may be considered an unnecessary overhead. However, for strict compliance, they must be used in certain places, as will be discussed.

Why do we need a serializable EJB reference? There are two main reasons: to enable an EJB reference to be stored in an object that is replicated across a network, or to allow a session EJB to have a lifetime longer than its client’s process. We will discuss ...

Get Applied Enterprise JavaBeans™ Technology 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.