Java Reference
In-Depth Information
To achieve compile-time consistency, the bean implementation class now imple-
ments the business service interface as shown in Listing 4-27. Note that I will continue to
use application services as is.
Listing 4-27.
public class UnderwritingRemoteBean extends AbstractStatelessSessionBean
implements UnderwritingBusinessService{
private final String SERVICE_BEAN_KEY = "uwrAppService";
private UnderwritingApplicationService uwrAppService;
public void underwriteNewPolicy(String productCd, String name, int age)
throws RemoteException {
//delegate business processing to application service
uwrAppService.underwriteNewPolicy(productCd, name, age);
protected void onEjbCreate() throws CreateException {
//use for initialisation
uwrAppService = (UnderwritingApplicationService)
Now the compile-time consistency is among the remote interface, and the enterprise
bean class is ensured. Amidst all the changes, the home interface remains unaffected.
The business interface is not limited to providing compile-time checks. It can be used
with the Spring proxy-based service locators to remove the code redundancy associated
with the business delegate. Proxies are like duplicates that stand in for the real object. To
remove the business delegate layer, you will need to alter the page controllers to now
work with the business interface, as shown in Listing 4-28.
Search WWH ::

Custom Search