Writing And Running A Standalone Java Test Client (EJB 3.0 Entities Creating)

Create the InheritanceClient a standalone Java test client as described in Writing A Standalone Java Test Client section:

Source folder: InheritanceHierarchies/src

Package: by.iba.client

Name: InheritanceClient

Check the public static void main method checkbox.

Copy-paste the following code in the method:

try {
	Context jndiContext = new InitialContext();
	Object ref = jndiContext.lookup("ManagerBean/remote");
	Manager manager = (Manager) PortableRemoteObject.narrow(ref, Manager.class);
	manager.populate();					
} catch (NamingException ne) {
	ne.printStackTrace();
}
					

NOTE: To resolve imports problems press Shift + Ctrl + O. Press Ctrl + S to save the Java class.

Run the Java class (as Java application). New entites had been created and persisted in database.

Professional hosting     Belorussian informational portal         Free SCWCD 1.4 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free Mock Exam Engine