Hiya,
I am trying to expose all the objects via rmi to provide an application layer and am running into a problem. When passing an object back to session to save, the object is the stub instead of the implemented class.
In more detail,
I have effectively the following class remotely available over RMI
public class HBUtilImpl implements HBUtil {
public void persist (ObjectA obj);
// ...
}
ObjectA is also remoted
public class ObjectAImpl implements ObjectA {
public void method 1() throws RemoveException;
// ...
}
ObjectA is created from ObjectAFactory
public class ObjectAFactoryImpl implements ObjectAFactory {
public ObjectA newObject() {
return new ObjectAImpl();
}
// ...
}
On the client, I can pick up the ObjectAFactory and create a new object.
ObjectAFactory factory = getRemoteInterface("ObjectAFactory");
ObjectA obj = factory.newObject();
The above works fine. However, the following fails
HBUtil hb = getRemoteInterface("HBUtil");
hb.persist(obj);
since for hb, obj is ObjectAImpl_Stub and not ObjectAImpl.
Am I approaching this completely wrongly or is there some way to resolve this.
Any help in resolving this greatly appreciated.
Best Wishes
O
|