【发布时间】:2012-05-28 05:35:42
【问题描述】:
我有一个我想使用 Objectify 持久化的类,这个类将表示一个大于 1MB 的数据,所以有一个 Blob 对象列表,它表示存储的字节数组的一个片段,它的大小小于 1MB:
@Entity
public class BigBlob {
@Id
private Long id;
public static final int FRAGMENT_LIMIT = 777 * 1024;
@Serialized
private List<Blob> fragments = new ArrayList<Blob>();
...
}
然而,“片段”是@Serialized,这将使这个 BigBlob 类/对象的大小大于 1MB。
导致此错误:
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.
如果我使用 @Embedded 注释,我会收到此错误:
Cannot place array or collection properties inside @Embedded arrays or collections
如何确保“片段”存储为单独的实体?
顺便说一句,我已经有了字节分块逻辑,它可以切分整个字节数组并将片段放入Blob 的List,所以这个问题与如何切分字节无关。
我想知道的更多是持久性方面。
【问题讨论】:
标签: google-app-engine objectify