Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
根据文档,模型应该是这样的
public class Employee { @Id String name; Key<Employee>[] subordinates; }
我需要知道如何将下属添加到员工。
更好的方法可能是每个Subordinate实体都拥有一个与其经理一起的属性,如下所示:
Subordinate
public class Employee { @Id String name; Key<Employee> manager; }
在任何情况下,如果您仍然希望在每个Employee实体中都有一个下属列表,请首先获取该实体,将Key下属的 添加到列表中,然后保存该实体。
Employee
Key
希望这可以帮助。