我有一个类Data
,它实现了Serializable
接口。本课程具有此类字段Gwt序列号
private boolean q = false;
private String a = "";
private List<Someclass> m = Collections.emptyList();
private List<Object[]> d = Collections.emptyList();
分配给这些成员的值是默认值。 Someclass
类还实现Serializable
并且它具有这样的列
private Types sqlType;
private int columnWidth;
private String columnName;
Types
是这也实现了串行化的一个枚举。
在Data
I类具有List<Object[]> d
中,我将节省通过JDBC从数据库fethced数据(迭代ResultSet
当我使用getObject()
方法)。我使用这样的构造,因为它可以运行任何查询(查询的结构未知)。在List<Someclass> m
举行询问的metada。所以当我尝试用简单查询获取行时,我得到了
com.google.gwt.user.client.rpc.SerializationException: Type '[Ljava.lang.Object;' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = [Ljava.lang.Object;@127053a9
它为什么发生?我所有的传输对象都是可序列化的。
编辑 好吧,Object
无法序列化,因此它不能被传递到并从服务器返回。但是我应该在这种情况下使用。泛型不会帮助我,因为我不知道在编译时的类型
无论“Object”不可串行化,最好在RPC调用中使用ArrayList而不是List。参见[http://stackoverflow.com/a/3060233/595072](http://stackoverflow。com/a/3060233/595072) – dimchez
我们使用ArrayList而不是'ArrayList