Integer pk_1 = new Integer(100);
CabinRemote cabin_1 = home.findByPrimaryKey(pk_1);
// Serialize the Handle for cabin 100 to a file.
Handle handle = cabin_1.getHandle();
FileOutputStream fos = new FileOutputStream("handle100.ser");
ObjectOutputStream outStream = new ObjectOutputStream(fos);
System.out.println("Writing handle to file...");
outStream.writeObject(handle);
outStream.flush();
fos.close();
handle = null;
// Deserialize the Handle for cabin 100.
FileInputStream fis = new FileInputStream("handle100.ser");
ObjectInputStream inStream = new ObjectInputStream(fis);
System.out.println("Reading handle from file...");
handle = (Handle)inStream.readObject();
fis.close();
// Reobtain a remote reference to cabin 100 and read its name.
System.out.println("Acquiring reference using deserialized handle...");
ref = handle.getEJBObject();
CabinRemote cabin_2 = (CabinRemote)
PortableRemoteObject.narrow(ref, CabinRemote.class);
if(cabin_1.isIdentical(cabin_2)) {
System.out.println("cabin_1.isIdentical(cabin_2) returns true - This is correct");