C M P   2 . 0  
      setGangsterId(id); 
      setName(name); 
      setNickName(nickName); 
      return null; 
   } 
   public void ejbPostCreate(Integer id, String name, String nickName) { } 
   // CMP field accessors                                                      
   public 
abstract
 Integer 
getGangsterId
(); 
   public 
abstract 
void 
setGangsterId
(Integer gangsterId); 
   public 
abstract 
String 
getName
(); 
   public 
abstract 
void 
setName
(String name); 
   public 
abstract 
String 
getNickName
(); 
   public 
abstract 
void 
setNickName
(String nickName); 
   // EJB callbacks                                                             
   public void setEntityContext(EntityContext context) { ctx = context; } 
   public void unsetEntityContext() { ctx = null; } 
   public void ejbActivate() { } 
   public void ejbPassivate() { } 
   public void ejbRemove() { log.info("Removing " + getName()); } 
   public void ejbStore() { } 
   public void ejbLoad() {} 
} 
Listing 9 3, Entity Implementation Class 
The entity bean implementation class must be abstract, because the cmp field abstract 
accessors are abstract.  Also, each cmp field is required to have both a getter and a setter 
method, and each accessor method must be declared public abstract. 
Entity Declaration 
The declaration of an entity in the ejb jar.xml file has not changed much in CMP 2.0. The 
declaration of the GangsterEJB follows: 
 
   
" //Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
  
   "http://java.sun.com/j2ee/dtd/ejb jar_2_0.dtd"> 
 
    
       
         Gangster Entity Bean 
         GangsterEJB 
         
org.jboss.docs.cmp2.crimeportal.GangsterHome
 
83






footer




 

 

 

 

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

best web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved