如何正确添加/操纵实体组中的数千名儿童?

这是我之前关于在BigTables / JDO中处理大量对象的问题 。

假设TransactionAccount最终可能在其transactions列表中包含多达10,000个对象,那么它如何与Goodle应用程序引擎一起使用?

如何在没有将整个列表加载到内存中的情况下将对象添加到如此大的列表中? (假设不应该将10,000个对象加载到内存中?)

我不是想问你如何做我的功课,我只是不知道从哪里开始解决这个问题,应用引擎文档和谷歌搜索没有帮助:(

 // example only, not meant to compile @PersistenceCapable public class TransactionAccount { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) public Key key; private long balance; private long transactionCount; @Element(dependent = "true") private List transactions = new ArrayList(); .... public long getBalance() { return balance; } } @PersistenceCapable private class Transaction { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) public Key key; public Date date; public long amount; } 

此问题已提出但未在以下google网上论坛中解决。

尝试标记事务属性@NotPersistent ,以便它根本不存储在数据存储区中。 您可以使用祖先查询获取给定TransactionAccount的Transaction实体(在此线程中更多)。 因此,您应该能够为给定帐户存储任意多个交易,因为它们并非都存储在帐户实体中。

一个不那么激烈的措施是用这个注释标记未编入索引的交易属性:

 @Extension(vendorName = "datanucleus", key = "gae.unindexed", value="true") 

帐户的交易仍然会存储在列表中,但它们不会被编入索引,这会使其更加可行。 你仍然会在大约10-100k的交易中达到1MB的实体大小限制,如果你使用@NotPersistent则不会有问题。