Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
public class UserManagementBean implements SessionBean {
private
LocalUserHome userHome = null;
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);
}
}
public void ejbCreate() throws CreateException {
try {
userHome = getUserHome();
} catch (NamingException e) {
throw new CreateWrapperException(
"Unable to find local user home in ejbCreate", e);
}
}
public void ejbActivate() {
try {
userHome = getUserHome();
} catch (NamingException e) {
throw new EJBException(
"Unable to find local user home in Activate", e);
}
}
Introducing EJB CMP/CMR, Part 1 of 2
Page 27 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