|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
MessageDrivenBean.The bulk of the changes in EJB 2.0 are found in the definition of a new CMP component model. It's radically different from the old CMP model because it introduces an entirely new participant, the persistence manager, and a completely new way of defining container-managed fields, as well as relationships with other beans and dependent objects.
The introduction of the MessageDrivenBean (the message bean) is also significant. The message bean represents the integration of JMS (Java Message Service) with EJB
to create an entirely new type of bean designed to handle asynchronous JMS messages. That exciting new bean type provides
a component model for JMS clients, allowing them to be deployed in the rich and robust environment of an EJB container system.
There are many other smaller changes made to the specification. Those other changes, while important, are mostly concerned with tightening the specification to eliminate ambiguities and make the components more portable. This article focuses on the new CMP and message bean component models introduced in EJB 2.0.
I provide several concrete examples, so it should be fairly easy to follow and comprehend. EJB novices might, however, find the material more difficult since it's assumed that readers have a basic understanding of EJB. For more information on EJBs, please see Resources.
Container-managed persistence has undergone radical changes in EJB 2.0. In EJB 2.0, the persistence manager handles persistence of CMP entity beans automatically at runtime. The persistence manager is responsible for mapping the entity bean to the database based on a new bean-persistence manager contract called the abstract persistence schema. In addition, the persistence manager is responsible for implementing and executing find methods based on a new query language called EJB QL.
It's important to note that products that comply with the EJB 2.0 specification must support the EJB 1.1 CMP model as well as the new EJB 2.0 model. While those models are not compatible, support is required for the EJB 1.1 model to ensure backward compatibility.
To understand how the abstract persistence schema works and why it's important, I will quickly review for you how CMP is handled in EJB 1.1, and then discuss how it's defined in EJB 2.0.
In EJB 1.1, the bean developer is responsible for declaring the bean class' persistent fields as either Java primitive or
serializable types. The following examples show an Employee enterprise bean class, as defined in EJB 1.1, with several CMP fields: