是否可以在Google App Engine(Java)中存储嵌入式类的集合?如果是这样,我将如何注释它?
这是我的班级:
@PersistenceCapable
public class Employee
{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;
@Persistent(embeddedElement = "true")
private List<ContactInfo> contactDetails = new ArrayList<ContactInfo>();
public void addContactInfo(String streetAddress, String city)
{
this.contactDetails.add(new ContactInfo(streetAddress, city));
}
public List<ContactInfo> getContactDetails()
{
return this.contactDetails;
}
@PersistenceCapable
@EmbeddedOnly
public static class ContactInfo
{
@Persistent
private String streetAddress;
@Persistent
private String city;
public ContactInfo(String streetAddress, String city)
{
this.streetAddress = streetAddress;
this.city = city;
}
public String getStreetAddress()
{
return this.streetAddress;
}
public String getCity() …Run Code Online (Sandbox Code Playgroud)