C M P   2 . 0  
As noted in the previous section, with a foreign key mapping the key fields declared in the 
ejb relationship role are added to the table of the related entity. If the key fields element is 
empty, a foreign key will not be created for the entity. In a one to many relationship, the 
many side (Gangster in the example) must have an empty key fields element, and the one 
side (Organization in the example) must have a key fields mapping. In one to one 
relationships, one or both roles can have foreign keys.  
The foreign key mapping is not dependent on the direction of the relationship. This means 
that in a one to one unidirectional relationship (only one side has an accessor) one or both 
roles can still have foreign keys. 
The complete foreign key mapping for the Organization Gangster relationship follows: 
 
    
       
         Organization Gangster 
          
          
             
org has gangsters 
             
                
                  
name
 
                  
organization
 
                
             
          
          
             
gangster belongs to org 
             
          
       
    
 
Listing 9 10, The jbosscmp jdbc.xml Foreign Key Mapping 
R e l a t i o n   t a b l e   M a p p i n g  
Relation table mapping is less common for one to one and one to many relationships, but is 
the only mapping style allowed for many to many relationships. The relation table mapping 
for  the Gangster Job relationship follows: 
 
    
       
         Gangster Jobs 
93






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