FileDocCategorySizeDatePackage
Client_3.javaAPI DocExample1569Sat Mar 06 09:46:04 GMT 1999com.titan.cabin

Client_3

public class Client_3 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 voidmain(java.lang.String[] args)

        try{
            Context jndiContext = getInitialContext();
            CabinHome c_home = (CabinHome)jndiContext.lookup("CabinHome");
            EJBMetaData meta = c_home.getEJBMetaData();

            System.out.println(meta.getHomeInterfaceClass().getName());
            System.out.println(meta.getRemoteInterfaceClass().getName());
            System.out.println(meta.getPrimaryKeyClass().getName());
            System.out.println(meta.isSession());

            CabinPK pk = (CabinPK)meta.getPrimaryKeyClass().newInstance();
            pk.id = 1;
            CabinHome c_home2 = (CabinHome)meta.getEJBHome();
            Cabin cabin = c_home2.findByPrimaryKey(pk);
            System.out.println(cabin.getName());

        }catch(java.rmi.RemoteException re){re.printStackTrace();}
         catch(javax.naming.NamingException ne)
              {ne.printStackTrace();}
         catch(Throwable t){t.printStackTrace();}