try {
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("CabinHome");
CabinHomeRemote c_home = (CabinHomeRemote)
PortableRemoteObject.narrow(ref, CabinHomeRemote.class);
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());
Class primKeyType = meta.getPrimaryKeyClass();
if (primKeyType.getName().equals("java.lang.Integer")) {
Integer pk = new Integer(1);
Object ref2 = meta.getEJBHome();
CabinHomeRemote c_home2 = (CabinHomeRemote)
PortableRemoteObject.narrow(ref2,CabinHomeRemote.class);
CabinRemote cabin = c_home2.findByPrimaryKey(pk);
System.out.println(cabin.getName());
}
} catch(java.rmi.RemoteException re){re.printStackTrace();}
catch(Throwable t){t.printStackTrace();}