如何创建具有父实体的实体(我之前创建的实体)?
我在文档里找不到任何对我有效的东西。
请提供如何创建具有父实体的实体的代码示例。
发布于 2016-08-06 22:56:48
我自己发现的!
Key key = datastore.newKeyFactory()
.ancestors(PathElement.of("kind_of_parent", "id_of_parent"))
.kind("kind_of_child")
.newKey("id_of_child");
Entity entity = Entity.builder(key)
.set("x", 1)
.set("y", 1)
.set("z", 1).build();
datastore.put(entity);https://stackoverflow.com/questions/38804168
复制相似问题