SCJP, SCWCD, SCBCD, SCEA 5
SCJP, SCWCD, SCBCD, SCEA 5
SCJP, SCWCD, SCBCD, SCEA 5
Stateful Session Bean Strategy
When an application uses enterprise beans in the business tier, it may be preferable to implement a session bean that uses the ValueListHandler. In this case, the session bean simply fronts an instance of a ValueListHandler. Thus, the session bean may be implemented as a stateful session bean to hold on to the list handler as its state, and thus may simply act as a facade or as a proxy.
Since the Value List Handler is a session bean, it may appear as a specialized Session Facade. However, in isolation, it is a specialized session bean rather than a specialized Session Facade. A Session Facade has other motivations and characteristics (explained in the Session Facade pattern), and it is much coarser grained.
Stateless Session Facade Strategy
When implementing the Session Facade, you must first decide whether the facade session bean is a stateful or a stateless session bean. Base this decision on the business process that the Session Facade is modeling.
A business process that needs only one method call to complete the service is a nonconversational business process. Such processes are suitably implemented using a stateless session bean.
A careful study of the use cases and scenarios enables you to determine the Session Facade definitions. If the use case is nonconversational, then the client initiates the use case, using a single method in the Session Facade. When the method completes, the use case completes too. There is no need to save the conversational state between one method invocation and the next. In this scenario, the Session Facade can be implemented as a stateless session bean.
Stateful Session Facade Strategy
A business process that needs multiple method calls to complete the service is a conversational business process. The conversational state must be saved between each client method invocation. In this scenario, a stateful session bean may be a more suitable approach for implementing the Session Facade.
In both the Stateless Session Facade and the Stateful Session Facade strategies, the business object's role can be fulfilled in different ways, as explained next.
Originally posted by Mohamed Farouk:
why is it impossible to use SLSB as a facade which includes a SFSB
Originally posted by Mohamed Farouk:
Thanks again
But i prefer a facade as it provides an interface to the business layer
So if i use a facade can it be SL holding a reference to SF and other SL session beans?