【发布时间】:2010-06-10 21:11:16
【问题描述】:
如何在下面的示例中向子实体添加记录?例如 我有一个员工记录,名字是“Sam”。如何为 sam 添加 2 个街道地址?
猜猜我有一个
父实体是员工
import java.util.List;
// ...
@Persistent(mappedBy = "employee")
private List<ContactInfo> contactInfoSets;
子键是地址
import com.google.appengine.api.datastore.Key;
// ... imports ...
@PersistenceCapable
public class ContactInfo {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private String streetAddress;
// ...
}
【问题讨论】:
标签: google-app-engine google-cloud-datastore jdo