你如何正确地添加/操纵实体组中的数千名儿童? [英] How do you properly add/manipulate thousands of children in an entity group?

查看:108
本文介绍了你如何正确地添加/操纵实体组中的数千名儿童?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这进一步到我的处理大量对象的上一个问题在BigTables / JDO中。



假设 TransactionAccount 最终可能在其< c $ c> transactions list,这与Goodle应用程序引擎是如何工作的?



如何在没有整个列表被加载到内存中? (假设10000个对象不应该加载到内存中?)

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

  / / example only,not not to compile 
@PersistenceCapable
public class TransactionAccount {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
public key key;
私人长余额;
私人长期transactionCount;
@Element(依赖=true)
私人列表< Transaction> transactions = new ArrayList< Transaction>();
...
public long getBalance(){return balance;}
}

@PersistenceCapable
private class Transaction {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
公钥键;
public日期日期;
公开长期金额;
}

提出这个问题但未解决在以下谷歌群组发布

@NotPersistent ,以便它根本不存储在数据存储中。>解决方案

您可以通过祖先查询获取给定TransactionAccount的交易实体>(详见此主题)。因此,您应该能够为给定账户存储任意数量的交易,因为它们并非全部存储在账户实体中。



一个不那么激烈的措施是使用此注释标记未标记的交易属性:

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

账户的交易仍然存储在列表中,但他们wouldn不会被索引,这会使它更加可行。但是,如果您使用 @NotPersistent ,那么您将达到1MB实体大小的10-100k次交易限制。

This further to my previous question on handling large numbers of objects in BigTables/JDO.

Assuming a TransactionAccount could end up with as many as 10,000 objects in its transactions list, how does this work with Goodle app engine?

How do you add objects to such a large list without the whole list being loaded into memory? (The assumption is that 10,000 objects shouldn't be loaded into memory?)

I am not trying to ask you how to do my homework, I just have no idea where to start to solve this, the app engine documentation and google searching is not helping :(

// 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<Transaction> transactions = new ArrayList<Transaction>();
    ....
    public long getBalance() { return balance; }
}

@PersistenceCapable
private class Transaction {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    public Key key;
    public Date date;
    public long amount;
}

This question is raised but not resolved in the following google groups post.

解决方案

try marking the transactions property @NotPersistent, so that it's not stored in the datastore at all. you can get the Transaction entities for a given TransactionAccount with an ancestor query (more in this thread). with that, you should be able to store arbitrarily many transactions for a given account, since they're not all stored in the account entity.

a less drastic measure would be to mark the transactions property unindexed with this annotation:

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

the account's transactions would still be stored in the list, but they wouldn't be indexed, which would make it a bit more feasible. still, you'd hit the 1MB entity size limit around 10-100k transactions, which wouldn't be a problem if you use @NotPersistent.

这篇关于你如何正确地添加/操纵实体组中的数千名儿童?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆