package com.titan.cabin;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.ejb.CreateException;
import java.rmi.RemoteException;
import java.util.Properties;
public class Client_4 {
public static void main(String [] args){
try{
Context jndiContext = getInitialContext();
CabinHome home = (CabinHome)jndiContext.lookup("CabinHome");
Cabin cabin_1 = home.create(101);
CabinPK pk = (CabinPK)cabin_1.getPrimaryKey();
Cabin cabin_2 = home.findByPrimaryKey(pk);
}catch(java.rmi.RemoteException re){re.printStackTrace();}
catch(javax.naming.NamingException ne)
{ne.printStackTrace();}
catch(Throwable t){t.printStackTrace();}
}
public static Context getInitialContext()
throws javax.naming.NamingException{
Properties p = new Properties();
// ... specify the JNDI properties specific to the vendor
return new javax.naming.InitialContext(p);
}
} |