ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
...
}
Notice that only the getter method was exported to the local interface because only the
getter method had the XDoclet
ejb.interface
tag associated with it.
XDoclet and EJB technology: ejb.relation tag
The
ejb.relation
tag allows you to define a CMR relationship. The tag is fairly
straight forward as the attribute names match the corresponding element names really
closely in the EJB deployment descriptor.
The following example sets up a one to many relationship from the
DeptBean
to the
EmployeeBean
.
...
public abstract class DeptBean implements EntityBean {
...
/**
* @return return employees in this department
*
* @ejb.interface method view type="local"
*
* @ejb.transaction type="Required"
*
* @ejb.relation
*
name="EmployeesInADepartmentRelation"
*
role name="DeptHasEmployees"
*
target role name="EmployeeInADept"
*
target cascade delete="no"
*/
public abstract Collection getEmployees();
/** @ejb.interface method view type="local" */
public abstract void setEmployees(Collection collection);
...
Notice that the relationship is given a name. Then you describe the DeptBeans role in
the relationship. You could also specify that when an instance of this bean is deleted
Page 38 of 49
Enhance J2EE component reuse with XDoclets






footer




 

 

 

 

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

j2ee 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