Overview
An entity bean is defined as a representation of persistent data that has the ability to read from database and populate its fields with data. It can be updated and stored back to the database. There are two types of entity beans: Bean-Managed Persistence(BMP) and Container-Managed Persistent(CMP). This article covers an example of a CMP, more specifically, a CMP application migration. For this type of entity bean, actual code must be written to handle persistent operations such as loading, saving and finding data. The developer must use persistence API such as JDBC to select, insert, update, delete from a database.
This article is organized in the following sections:
- CMP implementation analysis
- Sample application
- The JBoss environment
- The Geronimo environment
- Step-by-step migration
- Summary
CMP implementation analysis
CMP implementation may vary from one vendor to another. The purpose of this section is to provide a CMP specific feature-to-feature comparison between JBoss v4 and Apache Geronimo M5 so you can clearly identify the differences and plan accordingly before migration.
Feature |
JBoss v4 |
Geronimo M5 |
---|---|---|
EJB Container |
JBoss AS 4.0 comes with its own EJB Container implementation. |
Geronimo uses OpenEJB as its EJB Container. |
Sample application
The Loan application is very simple. When the command line client is run, an entry is made into the database. The findByPrimaryKey() method of the CustomerHomeRemote interface is called and the field values of the returned CustomerRemote object are printed to the console. This is followed by a call to the findBySssNo() method after which the field values of the returned CustomerRemote object are printed to the console.
The following figure illustrates the application flow: