Chapter 3 - EJB 3.0 Session Bean Component Contract & Lifecycle
In client, a session object is a non-persistent object that implements business logic running on the server.session object is as a logical extension of the client program that runs on the server. A session object is not shared among multiple clients.
A client NEVER directly accesses instances of the session bean class. A client accesses a session object through the session bean client view interface.
The client of a session bean may be a local client, a remote client, or a web service client, depending on the interface provided by the bean and used by the client.
A remote client of an session bean can be another enterprise bean deployed in the same or different container; or it can be an arbitrary Java program, such as an application, applet, or servlet.
The interface used by a remote client of a session bean is implemented by the container as a remote business interface and the remote client view of a session bean is location-independent.
A client running in the same JVM as the session object uses the same API as a client running in a different JVM on the same or different machine.
Use of a session bean's local business interface(s) or local interface entails the collocation of the local client and the session. The local client of an enterprise bean must be collocated in the same container as the bean. The local client view IS NOT location-independent.
The client of a stateless session bean is a web service client. Only a STATELESS session bean can be provide a web service client view. A web service client use the enterprise bean's web service client view, as described by a WSDL document.
The bean's client view web service endpoint is in terms of a JAX-WS endpoint or JAX-RPC endpoint interface.
From its creation until destruction, a session object lives in a container. The container provides security, concurrency, transactions, swapping to secondary storage, and other services for the session object transparently to the client.
Each session object has an identity and does not survive a crash and restart of the container, although a high-end container implementation can mask container and server crashes to a remote or web service client.
Multiple enterprise beans can be installed in a container. The container allows the clients of session beans that provide local or remote client views to obtain the business interfaces
and home interfaces of the installed enterprise beans through dependency injection or to look them up JNDI.The client view of a session object is independent of the implementation of the session bean and the container.
Client view of a Session bean Overview in EJB