Exploring Business Tier
I nsurance applications, like most financial solutions, have complex business rules.
eInsure was no different. It had implemented very complex mathematical and statistical
formulas to derive the values for policy premiums, claim settlement amounts, and
several other properties. The eInsure application's business tier was built with EJB tech-
nology. The application heavily used both stateless session beans and entity beans.
eInsure also employed message-driven beans for asynchronous processing. In this
chapter, I will concentrate on session and message-driven beans. The entity beans are
integration tier components, which too are available remotely and provide persistence
support. With the current EJB 3.0 specification, entity beans are a thing of the past.
Hence, in this topic, I will not discuss them in detail.
In this chapter, I will explore some of the key design patterns that can be applied to
build a flexible yet simple business tier with the Spring Framework. I will start with the
Service Locator pattern, which consolidates the boilerplate code required to look up EJB
components registered in the JNDI. Then I will look into the Business Delegate pattern,
which provides a client-side proxy of the business objects. Business Delegate and Service
Locator work together to effectively connect the presentation tier with the business tier.
I will cover the business tier in depth and concentrate on showing how to build remotely
accessible business logic using the EJB session facade. You will also see the benefits of
POJO business tier components in association with the application service and EJB com-
mand object patterns. I will finish this chapter with a discussion of the Business Interface
pattern, which enforces certain compile-time checks on the session beans as well as sim-
plifies the Business Delegate pattern.