ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
public abstract void setEmail(String email);
public abstract String getPassword();
public abstract void setPassword(String password);
}
Notice that the entity bean is declared abstract, and that it defines abstract getters and
setter methods for its CMP fields. (Note that the ellipsis is used to abbreviate the listing
to the parts of interest.)
It is likely that you will have to map the entity to a database table and CMP fields to
columns that table. The next panel shows a sample table that could be used in
conjunction with this entity.
Sample table for
UserBean
The CMP fields in the
UserBean
may correspond to field in a relational table as
defined by the following SQL DDL:
CREATE TABLE TBL_USER (
email varchar (50)
PRIMARY KEY,
password varchar (50) NOT NULL
)
Note that since the mapping from entities to tables is left up to each individual EJB
container, I will not cover the specifics of the mapping in this tutorial. (This will be
covered in a follow up article that ports these examples to WebLogic and JBoss.)
Instead I use the default mapping provided by the J2EE reference implementation.
Defining CMP fields in the deployment descriptor
Each one of the CMP fields has to be defined in the deployment descriptor as follows:
password
Page 14 of 48
Introducing EJB CMP/CMR, Part 1 of 2






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

tomcat web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved