Retrieve each item individually.
- By Roger L. Cauvin
- June 24, 2001
Java To Go!
Empower your EJB clients with mobile actions
Roger L. Cauvin
Listing 2. Retrieve each item individually.
EmployeeStorage employeeStorage = employeeStorageHome.create();
Vector employeeSSNs = employeeStorage.retrieveEmployeeSSNs();
Enumeration enumeration = employeeSSNs.elements();
boolean wasFound = false;
Employee employee = null;
while (!wasFound && enumeration.hasMoreElements())
{String employeeSSN = (String) enumeration.nextElement();
employee = employeeStorage.retrieveEmployee(employeeSSN);
wasFound = employee.getName().equals("Jane Doe");}
if (wasFound)
System.out.println("Found employee " + employee + ".");
About the Author
Roger L. Cauvin is a software engineer at KLA-Tencor, Austin, TX. He can be contacted at [email protected].