Object stream replaces "LazyReference" with proxy using "readResolve" on client. Client code doe's not see this stuff, it is "transparent".
But I see "ServerBean" implementation is missing on this page.
Code:
public class LazyReference implements Serializable {
private static final long serialVersionUID = 7799616869249915673L;
private Serializable id;
private int token;
private String className;
/* package */Object readResolve() throws ObjectStreamException,
ClassNotFoundException {
return Proxy.create(token, Class.forName(className, false, Thread
.currentThread().getContextClassLoader()), id);
}
I think it is better to deploy hibernate on client using RMI/JDBC bridge than to fight with this stuff.
http://www.weblogic.com/docs51/classdocs/JDBC_RMI.html
http://rmijdbc.objectweb.org/