Enterprise JavaBeans are server-side components that encapsulate application
business logic. Enterprise JavaBeans simplify application development by
automatically taking care of transaction management and security. There are two
types of Enterprise JavaBeans: Session Beans, which perform business logic; and
Message-Driven Beans, which act as a message listener.
Readers familiar with previous versions of J2EE will notice that Entity Beans
were not mentioned in the above paragraph. In Java EE 5, Entity Beans have been
deprecated in favor of the Java Persistence API (JPA). Entity Beans are still supported
for backwards compatibility; however, the preferred way of doing Object Relational
Mapping with Java EE 5 is through JPA. Refer to Chapter 4 for a detailed discussion
on JPA.
The following topics will be covered in this chapter:
-
Session Beans
- A simple session bean
- A more realistic example
- Using a session bean to implement the DAO design pattern
-
Message-driven beans
-
Transactions in Enterprise Java beans
- Container-managed transactions
- Bean-managed transactions
-
Enterprise JavaBeans life cycles Stateful session bean life cycle
- Stateless session bean life cycle
- Message-driven bean life cycle
- EJB timer service
-
EJB security