Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
UserManagement
accesses the
UserBean
entity by looking up
UserBean
 s home
interface as follows:
package com.rickhightower.auth;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class UserManagementBean implements SessionBean {
private LocalUserHome getUserHome() throws NamingException {
Context initial = new InitialContext();
return (LocalUserHome) initial.lookup("java:comp/env/ejb/LocalUser");
}
Notice that the
getUserHome()
method is a private helper method that returns a
reference to the
UserBean
 s home interface (
LocalUserHome
). In order for the
UserManagementBean
to have access to the
UserBean
 s home interface the
following had to be added to the
UserManagementBean
 s deployment descriptor
within the session element as follows:
...
ejb/LocalUser
Entity
com.rickhightower.auth.LocalUserHome
com.rickhightower.auth.LocalUser
userEntity.jar#UserBean
...
Notice that the ejb local ref defines the reference to the
UserBean
. (The
UserBean
is
contained in an
.jar
file called
userEntity.jar
that I will cover in detail in
Compiling and
packaging your application
on page 31 .)
UserManagementBean
grabbing the
UserBean
 s
home interface
The
UserManagementBean
stores the reference to the home interface as a private
Introducing EJB CMP/CMR, Part 1 of 2
Page 21 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