Hi, Are you intending for ActualModelData to extend MyModelData rather than ModelData?
The code snippet seems to show it extending ModelData, which is implemented by MyModelData. So the ActualModelData class will run the setOldData method from ModelData rather than the setOldData method from MyModelData. Cheers, Jin On Oct 4, 11:29 pm, Quincy <[email protected]> wrote: > Hi, I'm encountering a problem that I can't work out related to RPC > and inheritence - the instance variable in my parent class didn't get > serialized. I'm using GXT for my project. Below are my code snipplet: > > /* The data that are transmitted over the wire */ > public abstract class MyModelData implements ModelData { > private String oldData = null; > > protected String setOldData(String s) { oldData = s; } > > } > > public class ActualModelData extends ModelData implements Serializable > { > private String someData = null; > // some other strings as well > > public ActualModelData() { super(); } > > /* basically lets me change the primary key */ > public void setData(String s) { > setOldData(someData); > oldData = s; > } > // Other getters/setters as required by ModelData > > } > > /* Server */ > // ...the interfaces as required > // inside MyServiceImpl: > bool change(ActualModelData serverData) { > // do stuff > > } > > /* Client */ > public class MyUI extends LayoutContainer { > // ... > // ActualModelData clientData; <-- instance variable originally came > from server > clientData.setData("blah"); > myService.change(clientData, new AsyncCallback<Boolean>() { > public void onFailure(Throwable error) {} > public void onSuccess(Boolean result) {} > }); > > The problem: serverData.oldData == null (both hosted and compiled > modes) > > I've stepped through the code in Eclipse: > In the client code, the clientData.oldData is definitely correctly set > when the "change" method was called (and was subsequently reset to > null elsewhere in the client code). > On the server side, serverData.oldData is null - I've even stepped > through the code before mine, and found that the String requestPayload > in RemoteServiceServlet.processPost(HttpServletRequest, > HttpServletResponse) doesn't contain any trace of the oldData value > (don't know how to read that string, but I've found the substring > representing the class type, followed by the known values of non-null > instance variables in ActualModelData). > > I've tried deleting the folder with the hosted.html and the *.gwt.rpc > files and getting Eclipse to rebuild them, but the problem persists. > I'm now not show how to proceed other than flattening the class > structure (I can remove the hierarchy but then I won't be able to use > a single data grid to edit all my data types). > > GWT version: 2.0.4 > GWT Designer version: 8.0.0 > AppEngine: 1.3.7 > GXT version: 2.20 > JRE: 1.6.0_20 > > Thanks -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
