使用 Objectify 检索实体组的元数据

Use Objectify to retrieve entity group's metadata

如何使用 Objectify 检索实体组的 metadata,特别是 __version__ 属性?

我想使用 __version__ 属性 来确定事务是否应该重试。那是因为 "it is possible to receive a DatastoreTimeoutException or DatastoreFailureException even when a transaction has been committed and will eventually be applied successfully."

在 Objectify 中没有什么特别的来管理这个字段,但是如果你像这样创建一个字段,它应该填充版本号:

@IgnoreSave long __version__;

那是每边两个下划线。