A Introduction
The EJB1.1 specification divides EJBS into two types: Session beans and entity beans. A session bean is a encapsulation of a business process, like a verb that describes a business process and method; An entity bean is a encapsulation of business data, like a noun, that describes business data, which is usually the object of a database record.
Entity beans are divided into CMP (Container Management bean-container management persistence) and BMP (Bean Management Bean-bean management persistence). CMP encapsulates a complex database storage mechanism, to provide us with the creation of data records, load, find, and delete methods, we need to develop the CMP and the data table mapping, and then call the appropriate method to complete the operation of the datasheet, which greatly reduced our development, but We also lose the flexibility to manipulate the database. So when we are developing, we will sometimes use BMP to complete our work.
This tutorial demonstrates how to use BMP to develop a complete application, including a complete database additions and deletions to the demo. Also, this tutorial shows you how to use Wsad to develop and test a Java EE application.
Two Application description
In this application, we will start from scratch using Wsad and DB2 to complete the following functions:
The user registers, for the sake of simplicity, we only need the user to provide his login account number, the password and the email can register. (Increase record)
User Login (Find specified record)
User changes password or email (update record)
Admin View all registered users (Find records)
Administrators Delete registered users (delete records).
Three Preparatory work
Before we start development, we're going to do the following
There is a good performance of the development machine is necessary, the recommended memory of 512M.
Install WSAD4.03 (Download trial version here)
If you are using Wsad for the first time, take a look at its help to familiarize yourself with its development environment.
Install DB2 UDB 7.2 (Download the trial version here)
Please follow the installation guide and create a db2admin administrator account prior to installation, the password is db2admin and set up to use this account to access the database at installation time
To upgrade DB2 JDBC driver to jdbc2.0, follow these steps:
Stop the DB2 "DB2 JDBC Applet Server" service
C:\net stop "DB2 JDBC Applet Server"