ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
Entity beans as follows:
/**
* Provides a session facade that works with cmp/cmr from EJB 2.0
* based entity beans.
*
* This bean must uses container managed transactions.
* It works with the others entity beans to provide authentication services.
* This bean does not maintain any state; thus, it can be stateless.
*
*
* @ejb.bean name="HRSystem" type="Stateless"
*
local jndi name="HRSystem"
*
*
* @ejb.ejb ref ejb name="DeptBean" view type="local"
* @ejb.ejb ref ejb name="EmployeeBean" view type="local"
*
*/
public class HRSystemBean implements SessionBean {
/**
* Get a list of all the depts.
*
* @return All the group names.
*
* This method is part of the ejb interface.
* @ejb.interface method view type="local"
* @ejb.transaction type="Required"
*/
public String[] getDepts() {
ArrayList deptList = new ArrayList(50);
Collection collection = LocalFinderUtils.findAll("DeptBean");
Iterator iterator = collection.iterator();
while (iterator.hasNext()) {
Dept group = (Dept) iterator.next();
deptList.add(group.getName());
}
return (String[]) deptList.toArray(new String[deptList.size()]);
}
Notice that the Session bean use the same
ejb.bean
tag, but instead of specifying
CMP, it specifies that this is a Stateless bean as follows:
/**
* Provides a session facade that works with cmp/cmr from EJB 2.0
* based entity beans.
*
*
*
* @ejb.bean name="HRSystem" type="Stateless"
Page 42 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