ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
Section 3. Returning more complex types
HRSystem SessionBean and DeptValue Bean
I felt it would be disingenuous to create just one example that only returns simple
types. Thus, I created a more complex example that returns a complex object, for
example, a non primitive type.
You can find a more complex example in the example source code under the directory
axisEJBDepartEmployees
. This example creates and exposes a stateless session
bean called
HRSystem
. The stateless session bean is configured to work with two
Entity beans that use CMP CMR 2.0.
Here is the code for HRSystem:
package ejb;
import bean.*;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.util.*;
import util.*;
/**
* Provides a session facade that works with cmp/cmr from EJB 2.0
* based entity beans.
*
* @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 dept value objects.
*
* This method is part of the ejb interface.
* @ejb.interface method view type="both"
* @ejb.transaction type="Required"
*/
public DeptValue[] getDepartments() {
ArrayList deptList = new ArrayList(50);
Page 24 of 33
Service enable EJB SessionBeans with the IBM ETTK






footer




 

 

 

 

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

servlet 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