1

在文档中,有大量关于“最终”一致性的信息。但是,我想知道与父/子值的一致性是什么。小例子

@Entity
class Parent {
    ...
    String parentName;
    Child child = new Child(parentName);
}

@Entity
class Child {
    ...
    String parentName;

    Child(String parentName) {
        this.parentName = parentName;
    }
}

如果我要更新 Parent 中的“parentName”字段,是否也可以在 Child 中更新它?

4

1 回答 1

1

If by parent/child you mean these two entities are created in the same entity group, then yes you can update both entities in a single transaction, and the update will be atomic and strongly consistent. (This entity group relationship is not fully specified in your code sample: you have to create the entities with appropriate keys.)

于 2012-05-23T20:25:32.037 回答