Google App Engine - owned relationship scalability problem
Google documentation describes the ability of the google app engine to store owned relationships using Collections. In the example below we have an Employee object having a List of ContactInfo objects. The problem I am having is that in order to add a new ContactInfo object to the List we have to retrieve ALL previous ContactInfo objects. They will get retrieved as soon as we touch the contactInfoList. If the Employee has lots of contacts a simple add operation would require lots of overhead. Am I missing something?
public class Employee {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent(mappedBy = "employee")
private List<ContactInfo> contactInfoList = new ArrayList<ContactInfo&开发者_如何学Cgt;();
You can instead save the new ContactInfo object after setting its employee property. It will be added to the list the next time Employee is loaded.
精彩评论