Objectify requires the Work executed for a transaction to be idempotent.
When a stale write occurs, the run block is executed again.
In your example, this would happen if there were two concurrent writes on
the entity that 'tk' points at. If you load inside the transaction, then
someString will be
Dear Nicholas,
Thank you.
The example code shows the illustration of loading the object outside the
transaction block. However, sometimes, we send the object to client, and
client modifies the object and sends back to server. Here, we have to
directly put the object and other processed objects
If you need strong consistency guarantees across network requests, you are
going to need to do a bit of extra work, since the datastore's transactions
only work within a single request. To make this concrete:
1A Client A request: Read Work key "foo", send it to the browser.
1B Client B request: