1 4 package org.objectweb.jonas.stests.appli; 5 6 import javax.naming.Context ; 7 import javax.naming.InitialContext ; 8 import javax.naming.NamingException ; 9 import javax.rmi.PortableRemoteObject ; 10 11 14 public class OrderEntryClerkClient { 15 16 static Context ctx = null; 17 static OrderEntryClerkHome oechome = null; 18 static CustomerHome chome = null; 19 20 public static void main(String [] arg) { 21 22 try { 24 ctx = new InitialContext (); 25 } catch (NamingException e) { 26 e.printStackTrace(); 27 System.exit(2); 28 } 29 30 String oecName = "OrderEntryClerkHome"; 32 String cName = "CustomerHome"; 33 try { 34 oechome = (OrderEntryClerkHome) PortableRemoteObject.narrow(ctx.lookup(oecName), OrderEntryClerkHome.class); 35 OrderEntryClerk oecbean = oechome.create(); 36 oecbean.createAllTables(); 37 System.out.println("all tables created"); 38 oecbean.setCustomer(new Integer (9)); 39 oecbean.addOrderLine(new Integer (20),24); 40 oecbean.addOrderLine(new Integer (10),12); 41 oecbean.addOrderLine(new Integer (1),1); 42 oecbean.addOrderLine(new Integer (2),6); 43 String numorder = oecbean.placeOrder(); 44 System.out.println("numorder = "+numorder); 45 oecbean.setCustomer(new Integer (5)); 46 oecbean.addOrderLine(new Integer (20),24); 47 oecbean.addOrderLine(new Integer (10),12); 48 oecbean.addOrderLine(new Integer (1),1); 49 oecbean.addOrderLine(new Integer (2),6); 50 numorder = oecbean.placeOrder(); 51 System.out.println("numorder = "+numorder); 52 53 } catch(Exception e) { 54 e.printStackTrace(); 55 System.exit(2); 56 } 57 58 } 60 } 61 | Popular Tags |