Chapter 8. Business Logic

You have now completed the data layer of your application, and are ready to dive into the business layer. If you recall from Chapter 2, the business layer incorporates your application’s business logic. Specifically, you will need to provide access to your entity beans, business calculations, and a scheduling facility. In this chapter, I’ll detail the access to entity beans already in place, and discuss how to handle more complex business tasks. Chapter 9 then details the scheduling process.

First, I’ll discuss the façade pattern, in which you use session beans to access entity beans. This access method is used instead of allowing direct access to entity beans, and is key to a sound strategy in building enterprise applications. I’ll also outline the problems and penalties associated with this approach, giving you the information you need to make good decisions in your own applications. This pattern goes hand in hand with the manager component discussed in Chapter 6 when working with directory servers. I’ll illustrate the pattern with a simple example, an OfficeManager session bean.

From there, I’ll move on to slightly more complex session beans. You’ll see how a single session bean can perform operations on multiple beans and on other Java components. You’ll build a UserManager component, which will administer users, and will operate upon the User entity bean as well as the LDAPManager directory server component. This should give you an idea of how to handle ...

Get Building Java Enterprise Applications 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.