例如,我有实体 Parent 和实体 Child。由于 Datastore 不允许连接,因此我无法将 parentKey 指定为 Child 中的属性。我的意思是,我可以,但这对我没有任何好处。
但是,如果我想在对 Child 的查询中检索 Parent 属性,是否可以通过将整个 Parent 实体指定为 Child 中的属性来解决问题?这样做合适吗?
Entity parentEntity = new Entity("Parent");
// ... process parentEntity
Entity childEntity = new Entity("Child");
childEntity.setProperty("parentEntity", parentEntity);