try {
Context ctx = getInitialContext();
// EJB 1.1: Use PortableRemoteObject.narrow() method
ShipHome home = (ShipHome)ctx.lookup("ShipHome");
home.create(2,"Utopia",4500,8939);
home.create(3,"Valhalla",3300,93939);
ShipPK pk = new ShipPK();
pk.id = 1;
Ship ship = home.findByPrimaryKey(pk);
ship.setCapacity(4500);
int capacity = ship.getCapacity();
Enumeration enum = home.findByCapacity(4500);
while (enum.hasMoreElements()){
// EJB 1.1: Use PortableRemoteObject.narrow() method
Ship aShip = (Ship)enum.nextElement();
System.out.println(aShip.getName());
}
} catch (Exception e){e.printStackTrace();}