我正在使用 JPA 2.0。 (EclipseLink 2.0.2)
如果实体包含关系,例如:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "userId")
private Collection<Blog> blogCollection;
通过 RPC 发送时出现以下错误:
com.google.gwt.user.client.rpc.SerializationException: Type 'org.eclipse.persistence.indirection.IndirectList' 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 = {[]}
最佳答案
一般来说,所有持久性 API 都使用一种名为代码注入(inject)的技术,这意味着它会在 POJO 类中注入(inject)代码以执行持久性工作。 由于这是在运行时执行的,GWT 编译器无法看到这一点,因此它无法为该类型生成序列化器。 解决方案不是通过线路发送持久性类。而是使用 DTO(数据传输对象)。
希望这有帮助。 问候 丹尼尔
关于gwt - 通过 GWT RPC 问题建立关系的实体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6405481/