Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
public void addUser(String email, String password) throws RemoteException;
public void removeUser(String email) throws RemoteException;
public boolean verifyPassword(String email, String password)throws RemoteException;
}
UserManagementBean
business methods
implementation
All EJB veterans should realize that the implementation of these methods are in the
implementation Session bean class as follows:
package com.rickhightower.auth;
public class UserManagementBean implements SessionBean {
public void addUser(String email, String password) {
try {
LocalUser user = userHome.create(email, password);
} catch (CreateException e) {
throw new EJBException
("Unable to create the local user " + email, e);
}
}
public void removeUser(String email) {
try {
userHome.remove(email);
} catch (RemoveException e) {
throw new EJBException("Unable to remove the user " + email, e);
}
}
public boolean verifyPassword(String email, String password){
try {
LocalUser user = userHome.findByPrimaryKey(email);
return user.getPassword().equals(password);
} catch (FinderException e) {
throw new EJBException
("Unable to create the local user " + email, e);
}
}
}
Introducing EJB CMP/CMR, Part 1 of 2
Page 23 of 48






footer




 

 

 

 

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

tomcat 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