FileDocCategorySizeDatePackage
CreatePersonCommand.javaAPI DocExample1137Sun Jul 20 17:40:26 BST 2003antipatterns.model

CreatePersonCommand

public class CreatePersonCommand extends Object

Fields Summary
private EJBPersonHome
personHome
Constructors Summary
Methods Summary
public voidinitialize()

        Hashtable properties = new Properties();
        //properties.put(Context.INITIAL_CONTEXT_FACTORY,
         //   "com.sun.jndi.cosnaming.CNCtxFactory");
        //properties.put(Context.PROVIDER_URL, "iiop://wgs97-74:1050");
       
        InitialContext ic = new InitialContext(properties);
        Object personRef = ic.lookup("ejb/EJBPerson");
        
        personHome =
        (EJBPersonHome)PortableRemoteObject.narrow(personRef, EJBPersonHome.class);
    
public voidrunCommand()

        
        String[] names = { "Jack", "Jill", "Bill", "Ted" };
        try {
            for(int i = 0; i < 1000; i++) {
                personHome.create(i, "test", "tester" + i, "555-0" + i);
            }
        } catch(Exception ex) {
            ex.printStackTrace();
            return;
        }