我有 2 个可序列化的零构造函数实体,具有 @OneToMany 关系(如果我只使用一个没有 @OneToMany 列表的实体,一切正常):
@Entity
@Table(name = "directory")
public class Directory implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String documentName;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private List<DirectoryValues> dirValues;
public Directory() {}
...
getters and setters
}
@Entity
@Table(name = "directoryvalues")
public class DirectoryValues implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String value;
public DirectoryValues() {}
...
getters and setters
}
当我添加 @OneToMany 注释时出现问题:
严重:调度传入的 RPC 调用 com.google.gwt.user.client.rpc.SerializationException 时出现异常:类型“org.hibernate.collection.PersistentBag”未包含在可由此 SerializationPolicy 或其类序列化的类型集中无法加载对象。出于安全考虑,此类型不会被序列化。: instance = [] at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:619)
我的实体列表有什么问题?