Based on this documentation 
<https://cloud.google.com/appengine/docs/standard/java/datastore/entities#Java_Embedded_entities>,
 
here is how you should embed and retrieve an entity:

Embed / Create : 

// Entity employee = ...;
EmbeddedEntity embeddedContactInfo = new EmbeddedEntity();

embeddedContactInfo.setProperty("homeAddress", "123 Fake St, Made, UP 
45678");
embeddedContactInfo.setProperty("phoneNumber", "555-555-5555");
embeddedContactInfo.setProperty("emailAddress", "[email protected]");

employee.setProperty("contactInfo", embeddedContactInfo);

Retrieve the Embedded Entity: 

Entity employee = datastore.get(employeeKey);
EmbeddedEntity embeddedContactInfo = (EmbeddedEntity) 
employee.getProperty("contactInfo");

On the above, the ContactInfo is embedded to the Employee. Here are current 
documentations about the EmbeddedEntity class 
<https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/datastore/EmbeddedEntity>
 and 
GitHub test implementations 
<https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/appengine-java8/datastore/src/test/java/com/example/appengine/EntitiesTest.java>
.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/83304679-8c52-4171-bdd1-ea17d03bb2b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine... Cole Abbeduto
    • [google-appe... 'Kenworth (Google Cloud Platform)' via Google App Engine

Reply via email to