FileDocCategorySizeDatePackage
Client_1.javaAPI DocExample1612Sat Mar 06 09:31:46 GMT 1999com.titan.cabin

Client_1

public class Client_1 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 home = (CabinHome)jndiContext.lookup("CabinHome");

            Cabin cabin_1 = home.create(1);
            cabin_1.setName("Master Suite");
            cabin_1.setDeckLevel(1);
            cabin_1.setShip(1);
            cabin_1.setBedCount(3);

            CabinPK pk = new CabinPK();
            pk.id = 1;

            Cabin cabin_2 = home.findByPrimaryKey(pk);
            System.out.println(cabin_2.getName());
            System.out.println(cabin_2.getDeckLevel());
            System.out.println(cabin_2.getShip());
            System.out.println(cabin_2.getBedCount());

        }catch(java.rmi.RemoteException re){re.printStackTrace();}
         catch(javax.naming.NamingException ne){ne.printStackTrace();}
         catch(javax.ejb.CreateException ce){ce.printStackTrace();}
         catch(javax.ejb.FinderException fe){fe.printStackTrace();}