Web design online - // Obtain the home and remove cabin 30.
Monday, December 31st, 2007// Obtain the home and remove cabin 30. Rerun the same cabin list. ref = jndiContext.lookup(”CabinHome”); CabinHomeRemote c_home = (CabinHomeRemote) PortableRemoteObject.narrow(ref, CabinHomeRemote.class); Integer pk = new Integer(30); c_home.remove(pk); list = agent.listCabins(1,3); System.out.println(”2nd List: After deleting cabin number 30″); for (int i = 0; i < list.length; i++) { System.out.println(list[i]); } First, the application creates a list of cabins, including the cabin with the primary key 30. Then it removes the Cabin EJB with this primary key and creates the list again. The second time the iteration is performed, cabin 30 will not listed. Because it was removed, the listCabin() method was unable to find a cabin with a primary key equal to 30, so it stopped making the list. The bean, including its data, is no longer in the database. Your output should look something like the following: 1st List: Before deleting cabin number 30 1,Master Suite ,1 3,Suite 101 ,1 5,Suite 103 ,1 7,Suite 105 ,1 9,Suite 107 ,1 12,Suite 201 ,2 14,Suite 203 ,2 16,Suite 205 ,2 18,Suite 207 ,2 20,Suite 209 ,2 22,Suite 301 ,3 24,Suite 303 ,3 26,Suite 305 ,3 28,Suite 307 ,3 30,Suite 309 ,3 2nd List: After deleting cabin number 30 1,Master Suite ,1 3,Suite 101 ,1 5,Suite 103 ,1 7,Suite 105 ,1 9,Suite 107 ,1 12,Suite 201 ,2 14,Suite 203 ,2 16,Suite 205 ,2 18,Suite 207 ,2 20,Suite 209 ,2 22,Suite 301 ,3 Copyright (c) 2001 O'Reilly & Associates
Adult web hosting has rich experience in providing unique solutions for the customer’s needs, just check frontpage web hosting services.