【发布时间】:2012-07-27 13:42:06
【问题描述】:
有没有办法控制用于拥有关系的提取大小?
例子:
@PersistenceCapable
public class Employee {
/** The contact info sets. */
@Persistent(defaultFetchGroup = "true")
@Element(dependent = "true")
private Collection<ContactInfo> contactInfoSets;
/** The key. */
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
public Collection<ContactInfo> getContactInfo() {
return contactInfoSets;
}
}
@PersistenceCapable
public class ContactInfo {
/** The key. */
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
}
在上面的例子中,如果我这样做:
Employee e = pm.getObjectById(Employee.class, "1");
e.getContactInfoSets();
它将获取 20 组中的每个拥有的联系人。如何告诉 jdo 在单个查询中获取所有联系人?
PS : 我尝试设置pm.getFetchPlan().setFetchSize(FetchPlan.FETCH_SIZE_GREEDY); 没有成功。
【问题讨论】:
标签: java google-app-engine jdo