PDA

View Full Version : Sending nested objects over RPC



rsmith59
5 Jun 2009, 12:03 PM
I am having difficulty sending a BaseModel object that contains a nested object(s) over RPC even when the nested objects extend BaseModel. Is this even possible to do? I can send nested native java objects like Strings and even Lists of Strings inside a BaseModel object, but not another custom java class, or a list of custom java objects. These objects are not coming from hibernate or any persistence layer.

Any ideas?

stan229
5 Jun 2009, 12:06 PM
do the objects implement serializable?
Can you show the stacktrace

rsmith59
5 Jun 2009, 12:59 PM
Yes, both objects extend BaseModel and implement Serializable. I get no stack trace, but gwt's ServerSerializationStreamWriter class is throwing a SerializationException at line 146. Here's my two classes:

public class User extends BaseModel implements Serializable {

private static final long serialVersionUID = 1L;

public String getName() {
return get("name");
}

public void setName(String name) {
set("name", name);
}

public Customer getCustomer() {
return get("customer");
}

public void setCustomer(Customer customer) {
set("customer", customer);
}
}

public class Customer extends BaseModel implements Serializable {

private static final long serialVersionUID = 1L;

public String getName() {
return get("name");
}

public void setName(String name) {
set("name", name);
}

}