Val, actually there is no reordering. It seems you use pessimistic repeatable read transaction and entries are flushed into DB in the same order entries are locked in memory.
You can do: 1. Lock all the keys in the same order, i.e. add cache.get("key1"); 2. switch to non-repeatable read transactions --Yakov