Chapter 21. EJB Design in the Real World

EJB has changed rapidly over the past couple of years with the introduction of EJB 3.0 and Java Persistence. Best practices for using EJBs “in the real world” are just now being documented, and already entire books have been written on how to use them. We cannot hope to cover everything in a single chapter. However, we can hit on the important topics regarding designing EJBs for use in real-world business applications.

This chapter covers:

  • The questions you need to ask about your EJB container, persistence provider, and database selections before you begin designing your EJBs and entity beans.

  • A step-by-step how-to for designing EJBs and entities from functional requirements to completed design, including the identification of potential base classes and EJB-helper classes.

  • Alternatives to EJB. In some places, Enterprise JavaBeans are not the best choice. The last section in this chapter helps you identify those places and introduces some alternatives.

Predesign: Containers and Databases

Before you begin designing your application, it is essential that you consider the execution environment in which your code is run. The execution environment includes the following specifics regarding your system:

Hardware platform
Operating system
Java Virtual Machine (JVM) implementation
Application server (EJB container and persistence provider)
Database server

Each of these elements has a direct effect on your application design’s success. We won’t talk about hardware ...

Get Enterprise JavaBeans 3.0, 5th Edition 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.