FileDocCategorySizeDatePackage
Client_4.javaAPI DocExample1995Sat Mar 06 09:47:34 GMT 1999com.titan.travelagent

Client_4

public class Client_4 extends Object

Fields Summary
Constructors Summary
Methods Summary
public static javax.naming.ContextgetInitialContext()


        Properties p = new Properties();
        // ... specify the JNDI properties specific to the vendor
        return new javax.naming.InitialContext(p);
    
public static voidgetTheEJBHome(TravelAgent agent)


        // the home interface is out of scope in this method
        // so it must be obtained from the EJB object
        TravelAgentHome home = (TravelAgentHome) agent.getEJBHome( );
        // do something useful with the home interface
    
public static voidmain(java.lang.String[] args)

        try{
            Context ctx  = getInitialContext();

            TravelAgentHome agentHome =
             (TravelAgentHome) ctx.lookup("TravelAgentHome");
            TravelAgent agent_1 = agentHome.create();
            TravelAgent agent_2 = agentHome.create();
            boolean x = agent_1.isIdentical(agent_2);
            // x will equal true; the two EJB object are equal

            CabinHome c_home =
             (CabinHome) ctx.lookup("CabinHome");

            CabinPK pk = new CabinPK();
            pk.id = 101;
            Cabin cabin_1 = c_home.findByPrimaryKey(pk);
            Cabin cabin_2 = c_home.findByPrimaryKey(pk);
            x = cabin_1.isIdentical(cabin_2);
            // x will equal true; the two EJB objects are equal

            }catch(java.rmi.RemoteException re){re.printStackTrace();}
             catch(Throwable t){t.printStackTrace();}